NAGIOS(N.A.G.I.O.S. is a recursive acronym: "Nagios Ain't Gonna Insist On Sainthood", "Sainthood" being a reference to the original name of the software, which was changed in response to a legal challenge by owners of a similar trademark). –wikipedia.org
NAGIOS is a system and network monitoring application that watches host and services that we specify as well as alerting when finds any error.
NAGIOS is implemented by using SNMP protocol, so which ever devices support SNMP we can monitor that device using NAGIOS.
NAGIOS can do following things
1.Monitor wide range of hosts like Servers,Switches,Routers etc.
2.Monitor network services (Like : SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, SSH.)
3.Monitor Host resources (Processor load, Running processes, Disk usage, System logs, etc)
4.Monitor Host environments(Temperature, Alarms etc).
Can alert you through e-mail, SMS, Pager etc.
NAGIOS can not do Monitoring of Bandwidth utilisation in network.
Step1: Before installing NAGIOS we required some packages to be installed, These are listed as below.
Apache(For accessing NAGIOS web interface),
gcc compiler,glibc, glibc-common and gd development library(for compiling source code which we are going download ).
# yum install httpd
# yum install gcc
# yum install glibc*
# yum install gd*
Step2 : First we have Create a new NAGIOS user account , group and it’s password.
# useradd nagios
# passwd nagios
# groupadd nagcmd
# usermod -G nagcmd nagios
# usermod -G nagcmd apache
We are adding "nagcmd" as secondary group to both "nagios" and "apache" user because some times we require to execute commands through web interface.
Step3 : Create a directory called download and download Nagios and it’s pluggins.
# mkdir ~/download
# cd ~/download
# wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.2.tar.gz
# wget http://osdn.dl.spurceforge.net/sourceforge/nagiosplug/nagios-pluggins-1.4.11.tar.gz
If you are unable to download using wget then use the following link to download nagios through GUI and nagiosplug:- http://www.nagios.org/download
Step4 : Now it’s time to Compile and install Nagios, to do this uncompress the tarball file and do as follows:
# cd /root/download
# tar -xvzf nagios-3.1.2.tar.gz ## extract the tar file.
# cd nagio-3.1.2
# ./configure –with-command-group=nagcmd
# make all
Stpe5 : Now Install binaries, init script, sample config file and set permissions on the external command(make install-commandmod) directory.
# make install
# make install-init
# make install-config
# make install-commandmod
Now NAGIOS is installed and the configuring files are stored in /usr/local/nagios/etc
Step6 : Install the NAGIOS web config file in the Apache conf.d directory.
# make install-webconf
Step7 : Create a nagiosadmin account for logging into the Nagios web interface.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Here it will ask for new password, enter the password and remember it in order to access NAGIOS web interface.
Step8 : Start nagios service by using below commands and add the nagios service to run at system start-up time.
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
When we execute the above command the output will be as below.
Output like this:-
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org/)
Last Modified: 05-19-2008
Reading configuration data…
Running pre-flight check on configuration data…
Checked 35 services.
Checked 4 hosts.
Checking host groups…
Checked 1 host groups.
Checking service groups…
Checked 0 service groups.
Checked 1 contacts.
Checking contact groups…
Checked 1 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checked 25 commands.
Checking time periods…
Checked 5 time periods.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…
Total Warnings: 0
Total Errors: 0
Things look okay – No serious problems were detected during the pre-flight check.
If output comes like this, it means there is no error.
Step9 : start the nagios service and configure the service to run at start-up time of the system
# service nagios start
# chkconfig –add nagios
# chkconfig nagios on
Stpe10 : Use the following command to run the CGIs under the SElinux enforcing/targated mode. This will eliminate security loopholes.
# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
# chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
Stpe11 : Now change the contact details in
/usr/local/nagios/etc/objects/contacts.cfg, you will find nagiosadmin, change the e-mail id associated to it with your required e-mail id, so that alerts .
Step12 : Now restart the apache server
# service httpd restart
Step13 : Access the Nagios web interface through your web browser:
Note:- Here you will be prompted for the username (nagiosadmin) and password that is given by you at step7 ).
I will update the blog how to monitor different devices such as Servers, Network devices and System resources and how to get alerts through SMS, e-mail and Pager. Please keep us visiting.