Professional Documents
Culture Documents
I. Overview oI nagios
II. 8 steps Ior installing nagios on Linux:
1. Download the nagios and plugins
2. Take care oI the prerequisites
3. Create user and group Ior nagios
4. Install nagios
5. ConIigure the web interIace
6. Compile and install nagios plugins
7. Start Nagios
8. Login to web interIace
III. ConIiguration Iiles overview
I. Overview of Nagios
.
Nagios is a host and service monitor tool. Following are some oI the Ieatures oI nagios.
Monitor equipments such as servers, switches, routers, Iirewalls, power supply etc.
Monitor services such as disk space, cpu usage, memory usage, temperature oI the equipment, HTTP, Mail, SSH etc.
Nagios can monitor pretty much anything. Ior e.g. host, services, databases, applications etc.
Nagios has an extensible plugin interIace Ior monitoring user deIined services. There are lot oI plugins available Ior Nagios. Visit NagiosPlugins and NagiosExchange Ior review
the available user developed plugins.
It can send out various notiIications ( email, pager etc.) when the problem occurs and get resolved.
Web interIace to view current status, notiIications, problem history, log Iiles etc.
Following is a partial screenshot oI the nagios web dashboard:
Ads b Google Uni to Linu Debian Linu Server Nagios Tool RedHat Linu
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
2/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
Fig: Nagios Web UI (click on the image to enlarge)
II. 8 steps for installing nagios on Linu:
1. Donload the nagios and plugins
Download following files from Nagios.org and move to /home/downloads
nagios-3.0.1.tar.g
nagios-plugins-1.4.11.tar.g
2. Take care of the prerequisites
Make sure apache is working on the server b verifing from browser: http://localhost
Verif whether gcc is installed
[@cah]#rpm -qa grep gcc
gcc-3.4.6-8
ca-gcc-32-3.2.3-47.3
ibgcc-3.4.6-8
ca-ibgcc-296-2.96-132.7.2
ca-gcc-32-c++-3.2.3-47.3
gcc-c++-3.4.6-8
Verif whether GD is installed
[@cah]# -a gd
gd-2.0.28-5.4E
3. Create user and group for nagios
[@cah]# eadd agi
[@cah]# ad agi
[@cah]# gadd agcd
[@cah]# ed -G agcd agi
[@cah]# ed -G agcd aache
4. Install nagios
[@cah]# a f agi-3.0.1.a.g
[@cah]# cd agi-3.0.1
[@cah]# ./cfige --ih-cad-g=agcd
[@cah]# ae a
[@cah]# ae ia
[@cah]# ae ia-cfig
[@cah]# ae ia-cadde
Following are some additional parameters that ou can pass to ./configure to customie our installation. I used onl --with-command-group as shown above.
--efi //agi Whee he Nagi fie
--ih-cgi /agi/cgi-bi Web ee hee he cgi' i be aaiabe
--ih-h /agi Web ee hee agi i be aaiabe
--ih-agi-e agi e acc de hich Nagi i
--ih-agi-g agi g acc de hich Nagi i
--ih-cad-g agcd g acc hich i a he aache e bi
cad Nagi
At the end of the configure output, it will displa a summar as shown below:
*** Cfigai a f agi 3.0.1 05-28-2008 ***:
Geea Oi:
Netork Monitoring .ni mof.com/neok-moni oi ng
Diagnoe & Reole Neok Ie. Donload
Fee Tial!
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
3/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix: /usr/local/nagios
Lock file: ${prefix/var/nagios.lock
Check result directory: ${prefix/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
5. Configure the web interface.
[root@localhost]# make install-webconf
[root@localhost# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
6. Compile and install nagios plugins
[root@localhost]# tar xvf nagios-plugins-1.4.11.tar.gz
[root@localhost]# cd nagios-plugins-1.4.11
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost]# make
[root@localhost]# make install
Note: On Red Hat, the ./configure command mentioned above did not work and was hanging at the when it was displaying the message: checking for redhat spopen problem
Add enable-redhat-pthread-workaround to the ./configure command as a work-around for the above problem as shown below.
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
7. Start Nagios
Add the nagios to the startup routine:
[root@localhost]# chkconfig --add nagios
[root@localhost]# chkconfig nagios on
Verify to make sure there are no errors in the nagios configuration file:
[root@localhost]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Start the nagios
[root@localhost]# service nagios start
Starting nagios: done.
8. Login to web interface
Nagios Web URL: http://localhost/nagios/
Use the userid, password that was created from step#5 above.
III. Configuration files overview
.
The first configuration to modify is to change the default value of email address in /usr/local/nagios/etc/objects/contacts.cfg file to your email address.
Following are the three major configuration files located under /usr/local/nagios/etc
1. nagios.cfg This is the primary Nagios configuration file where lot of global parameters that controls the nagios can be defined.
2. cgi.cfg - This files has configuration information for nagios web interface.
3. resource.cfg If you have to pass some sensitive information (username, password etc.) to a plugin to monitor a specific service, you can define them here. This file is
readable only by nagios user and group.
Following are the other configuration files under /usr/local/nagios/etc/objects directory:
contacts.cfg: All the contacts who needs to be notified should be defined here. You can specify name, email address, what type of notifications they need to receive and what
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
4/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
1
StumbleUpon
Share
10 Lie
contacts.cfg: All the contacts who needs to be notified should be defined here. You can specify name, email address, what type of notifications they need to receive and what
is the time period this particular contact should be receiving notifications etc.
commands.cfg All the commands to check services are defined here. You can use $HOSTNAME$ and $HOSTADDRESS$ macro on the command execution that will
substitute the corresponding hostname or host ip-address automatically.
timeperiods.cfg Define the timeperiods. for e.g. if you want a service to be monitored only during the business hours, define a time period called businesshours and specify
the hours that you would like to monitor.
templates.cfg Multiple host or service definition that has similar characteristics can use a template, where all the common characteristics can be defined. Use template is a
time saver.
localhost.cfg Defines the monitoring for the local host. This is a sample configuration file that comes with nagios installation that you can use as a baseline to define other
hosts that you would like to monitor.
printer.cfg Sample config file for printer
switch.cfg Sample config file for switch
windows.cfg Sample config file for a windows machine
I will discuss about the steps to configure a remote Linux Host and Windows Host for monitoring through nagios in upcoming posts.