Jun 212009
 

Nagios is a free opensource enterprise-class monitoring system released under GPL License. It allows you to gain insight into your network and fix problems before customers know they even exist. It’s stable, scalable, supported, and extensible. Nagios is Stable, Reliable, and Respected Platform with 10 years in development scaling to 100,000+ nodes. From my personal view, Nagios is one of the best if not the best monitoring system and being opensource makes it that extra special. Nagios is simple and at the same time very flexible made possible by the plugin architecture and most importantly as the author puts it, it just works.

Features include,

Comprehensive Network Monitoring supportinh various hardware platforms, operating systems, applications services, appliances etc

Immediate Awareness and Insight with email, pager, mobile notifications and escalation capabilities

Problem Remediation with automatic restart of failed apps or services and acknowledgements

Proactive Planning with schedule downtime and capacity planning through usage monitoring

Reporting Options include SLA, Alert, notification and trending reports (using cacti & RRD-based integration addons)

Easily Extendable Architecture with over 200 community addons already available to enhance Nagios

Failover capabilities with distributed monitoring support

Our mission here is to get up and running with Nagios in less than 5 mminutes in openSUSE. So, let’s get on with it. We assume here that the Apache2 webserver is already installed on your openSUSE.

Install Nagios in openSUSE

Based on your version of openSUSE, click the following 1-click installs to install Nagios Core application, Nagios Plugins and Nagios Plugins extras (install in the same order)

|                                     | Nagios |                             | Nagios Plugins|             | Nagios Addons Extras |

openSUSE 11.1 oneclick oneclickoneclick

openSUSE 11.0 oneclick oneclickoneclick

openSUSE 10.3 oneclick oneclickoneclick


This should download the YMP file and automatically launch the YaST package manager to add the required Repositories, download and install Nagios, plugins and the extras and the required dependencies.

Upon completion of the installation, the following are the key locations where the Nagios application and the relevant files will be installed.

Nagiois config files

/etc/nagios

Nagios plugins and cgi’s

/usr/local/nagios

Nagios web interface

/usr/share/nagios

Apache config file

/etc/apache2/conf.d/nagios.conf

Users

The installation also creates the user account nagios and the groups nagios & nagcmd


Create an Admin user for nagios

opensuse11:~ # htpasswd2 -c /etc/nagios/htpasswd.users nagiosadmin

This creates a new htpasswd.user file (-c option) and installs nagiosadmin as a new user for nagios web interface. Any later user account should be added without the “-c” option as follows to avoid the risk of overwriting the htpasswd.users file

opensuse11:~ # htpasswd2 /etc/nagios/htpasswd.users nagiosuser

Thats the web interface sorted.

Make Nagios Start at system startup

Add Nagios to the list of services on the system and make it start automatically at the system start/restart as follows:

opensuse11:~ # chkconfig nagios

opensuse11:~ # chkconfig nagios on

We are nearly there to get Nagios up and running.

Restart Apache

Restart Apache2 webserver to enable the Nagios web interface

opensuse11:~ # rcapache2 restart

Start Nagios

The installation adds a configuration file for the localhost as /etc/nagios/objects/localhost.cfg. This checks the network status, system load, system users, HTTP, PING, Root partition, SSH, Swap and total processes running on the system. This gives us a quick look into Nagios before we go on and add additional systems and services.

opensuse11:~ # rcnagios start

nagios1 nagios2

nagios3 nagios4

Thats the installation complete. Open a web browser and browse to http://localhost/nagios or http://<IP Address>/nagios if browsing from another system on the network. (Make sure the firewall allows HTTP & HTTPS connections into this system). Enter the username and password for the admin user (nagiosadmin).

Thats it…Nagios is up and running. Now, you can add more devices like more Linux systems and servers, Windows or network appliances. Obviously,monitoring  needs could change from anything being a dead or alive (ping) test to more checks like the ones we do here on the localhost.

A quick tip would be to create seperate config files for different types of devices like Windows, Linux etc or even a config file for each of the devices. This approach of config files for each device can reduce the maintenance perspective as you can pin point issues (if any) down to the particular file for the particular device also, any changes we know is for sure going to be only on the relevant file. The downside would be maintaing the files themselves.

Also, for each of these config files. there needs to be an entry in the /etc/nagios/nagios.cfg file. For instance, the localhost config file is entered as

cfg_file=/etc/nagios/objects/localhost.cfg

Else the cfg file will be completely ignored. Also, a good practice would be to verifiy the config changes (including adding or deleteing new devices) as failing to do so can bring down Nagios completely. To verify simply run nagios with “-v” switch and the config file as follows:

opensuse11:~ # nagios -v /etc/nagios/nagios.cfg

This should report any errors. When all looks good, restart nagios as follows

opensuse11:~ # rcnagios nagios restart

For more configuration details, click here to view Nagios Documentation