Saturday, July 10, 2010

SUSE Linux Tips

Network Monitoring Through Nagios

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

nagios1nagios2

nagios3 nagios4

Thats the installation complete. Open a web browser and browse to http://localhost/nagios or http:///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

Related posts

This entry was posted on Sunday, June 21st, 2009 at 10:26 pm and is filed under Monitoring. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

<!--
google_ad_client = "pub-9633753545729491";
/* SuseGeek-Post-Bottom */
google_ad_slot = "3249034109";
google_ad_width = 336;
google_ad_height = 280;
//-->


No comments:

Post a Comment