How to Install Nagios 4.3.4 on CentOS 6 / RHEL 6


Nagios is the most widely used open source monitoring tools which help us to monitor the services and application that run’s on Windows, Linux, Routers and other network devices. With the help of Nagios, you can monitor basic services and attributes.

We can access the Nagios using web interface coming with the bundle and configuration need to be done on the file level ( Editing the conf file using the VI editor).

Services List

This Tutorial describes how you can monitor “private” services and attributes of Linux/UNIX servers, such as:


  • CPU load
  • Memory usage
  • Disk usage
  • Logged in users
  • Running processes
  • etc.

Private Services

  • HTTP
  • FTP
  • SSH
  • SMTP
  • etc


Before installing the Nagios, the system needs to meet the requirements for installing Nagios; So install the Web Server (httpd), PHP ,compilers and development libraries. Install all with single command.

yum install httpd php gcc glibc glibc-common gd

User Account

We required to create the user account for accessing the Nagios installation and configuration files. Before starting become the root user.

su -l

Create a new user in the name of “nagios” and give it a password.

useradd nagios

Set the password.

passwd nagios

Create a new group called nagcmd for allowing the external commands to be excuted through the web interface. change nagios and apache user to the created group.

groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

Download Nagios & Nagios Plugins

Download the Nagios and the Nagios plugins using the following command ( For latest version Visit Nagios WebSite )


Install Nagios

Extract Nagios archive.

tar -zxvf nagios-3.4.4.tar.gz
Run the Nagios configure script, with the group mentioned.
cd nagios
./configure --with-command-group=nagcmd

Compile the Nagios source code.

make all</>
Install binaries, init script, sample configuration files and set permissions on the external command directory.
make install 
make install-init 
make install-config 
make install-commandmode

Configure Nagios

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You’ll need to make just one change before you proceed…

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

vi /usr/local/nagios/etc/objects/contacts.cfg

Change the Email address field to receive the notification.

define contact{
contact_name    nagiosadmin   ; Short name of userus
generic-contact                     ; Inherit default values from generic-contact template (defined above)
alias   Nagios Admin           ; Full name of useremail         ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

Configure Web Interface

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

service httpd restart

Install Nagios Plugins

Extract the Nagios plugins source code tarball.

tar -zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16

Compile and install the plugins. While compiling i got an errorfor SSL Verison; here is the Nagios troubleshooting.

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make install

Start Nagios

Add it on system start-up using the following command

chkconfig nagios on

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

service nagios start


See if SELinux is in Enforcing mode.


Put SELinux on Permissive mode.

setenforce 0

To make this change permanent, you’ll have to modify the settings in /etc/selinux/config and reboot.

Access Nagios Web Interface

Now access the Nagios web interface using the following URL. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.


You will redirect to the home page, Click on the Services to view Status of Hosts.

That’s All.

You might also like

How to Install Nagios 4.3.4 on CentOS 6 / RHEL 6