Nagios installation and configuration

This tutorial aims to help the reader or sysadmin understand or visualize the seemingly intricate nagios configuration

As of installing nagios; you will get many documents on the Internet.So this document describes the configuration part mainly. It is better always to use the nagios packages available in your operating systems repository rather than installing from source;but you can install from source also if you know exactly what the make install commands drop in your os and where they drop it! .For the impatient here is the official Nagios Quick start installation guide => http://nagios.sourceforge.net/docs/3_0/quickstart.html

Now for the configuration part!.

Nagios Configuration overview

The above diagram shows that nagios can be essentially treated as having 2 parts .The cgis and the nagios daemon

The default cgi config file is => cgi.cfg

And the default nagios daemon file is =>nagios.cfg

These files are well commented and the default values would be fine for most situations.

Now comes the trickier part;what we are really monitoring!.What stuff we monitor is treated as objects by nagios and the defenition should go to the object configuration file or files defined in the nagios.cfg file with

cfg_file=/usr/local/nagios/etc/gnusys_objects.cfg

Assume we have a situation of monitoring say 2 servers and the notifications must go to 2 different engineers

We break the objects into :

1.services that we monitor

2. hostgroup which is a group of hosts whose services are to be monitored

3.contactgroup which is a group of people who all have to notified

4. contacts which are people who are to be notified

A good rule that helps you get a view of whats happening is:

Define a service for monitoring the status of the same for a hostgroup having n hosts and if there is a problem notify a contactgroup having k contacts;where n and k are the number of hosts and contacts respectively

Now that made things really simple. You just have to start from defining a service and mention the hostsgroup whose service this is and also specify the contactgroup who is responsible for this service

Just give a name of your choice for these hostgroup and contactgroups and restart nagios - nagios will surely throw an error!. Dont panic , you just have to go on defining these contactgroups and hostgroups and add some hosts and contacts in it

It doesnt end there also..now you have to define the individual hosts and the contacts.Thats it ; you are done

These configs can be edited in the object config files as mentioned below in that oder for clarity

cfg_file=/usr/local/nagios/etc/services.cfg

cfg_file=/usr/local/nagios/etc/hostsgroup.cfg

cfg_file=/usr/local/nagios/etc/contactgroups.cfg

cfg_file=/usr/local/nagios/etc/hosts.cfg

cfg_file=/usr/local/nagios/etc/contacts.cfg

A good tutorial for this configuration example is

http://www.debian-administration.org/articles/299

Please note that in the above tutorial instead of defining a service for a hostgroup ; it has been defined for an individual host.This is also valid

Posted under Uncategorized

This post was written by Anoop Alias on June 5, 2008

Leave a Comment

Name (required)

Email (required)

Website

Comments

More Blog Post