Content

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 http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

epel1

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

install-nagios3.5.1

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

configure-firewall

 

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

nagios-email-contact

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 100.100.100.100/32

/etc/httpd/conf.d/nagios.conf

allow-nagios-from2

Set password for user [nagiosadmin] with the following command

htpasswd /etc/nagios/passwd nagiosadmin

set-password

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 ]

http://your-server-ip/nagios

http-console1

 

http-console2

 

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?

Admin

Comments are closed.