Setup Nagios

Nagios is an open source monitoring tool that provides a monitoring environment to keep a tab on your network and machines, be it is in data-centre or in a small lab. Nagios alerts the system administrator when something went wrong and helps us to reduce downtime and business losses. We are going to setup nagios 3.5.1 in a freshly installed CentOS 6.7 and the installation process will work on Scientific Linux 6.X as well as RHEL 6.X


Install necessary epel repository for CentOS 6

Nagios will not be found in CentOS official repository. To install Nagios, we need to install EPEL repository and update.

sudo rpm -iUvh


Install dependencies & Nagios Packages

sudo yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp

Once we completed our dependencies installation we may proceed to install nagios packages as followed

sudo yum install nagios* -y

Turn on http service

sudo service httpd start
sudo chkconfig httpd on


Configure firewall

By default , http port is blocked hence you will need to unblock port 80 for web service.

sudo iptables -I INPUT 5 -p tcp -m tcp --dport 80 -j ACCEPT
sudo service iptables save
sudo service iptables restart



Configuring Nagios Contact

Edit the admin mail address in the nagios contact file to receive alerts from nagios server.

nano /etc/nagios/objects/contacts.cfg


Securing nagios

By default, nagios admin area will be accessible from any source hence if you like to restrict to specific source you may update the following. Example here shown that we only permit access to nagios administration console from Host with



Set password for user [nagiosadmin] with the following command

htpasswd /etc/nagios/passwd nagiosadmin


Restart httpd service now to apply all new changes

sudo service httpd restart

Start nagios service and let them start automatically on every boot

sudo service nagios start
chkconfig nagios on

Now we are ready to test our nagios installation by accessing the following url with the userid and password we set earlier [ nagiosadmin  and the password ]






Congratulation! Our Nagios server is ready for action

We will be updating another tutorial based on nagios Core 4.1.1 and including changing the theme in our next follow up.

Was this article helpful to you?


Comments are closed.