In the world of open source, when it comes to monitoring, Nagios is the most preferred choice. But managing multiple Nagios screens can be a daunting task. while looking for a simple solution i came across NagCen.

NagiosCenter is a centralized viewer to show data of several (more than one) Nagios server spreaded in different networks. It uses therefore a parser in python and also an PHP Mysql Web-fronted.

Requirements:

  1. NagCen – Download from here http://sourceforge.net/projects/nagcen/
  2. Php
  3. Python
  4. Mysql
  5. Working Nagios Server.
  6. Password-less setup between your Nagios Servers and Nagios Center (NagCen Server)
  7. HTTP (Apache) Server

Step 1. Create a database in mysql and assign a username and password to it.

# mysql

mysql> create database nagioscenter;

mysql> grant all privileges on nagioscenter.* to ''@'%' identified by "password";

Step 2. Create a directory and untar the downloaded NagiosCenter package in it.

# mkdir /nagioscenter

# cd /nagioscenter

# tar -xvzf NagCen.tar.gz

Step 3. Edit the default nagcen.conf file.

# cd /nagioscenter/daemon

# vi nagcen.conf

id=5

host=localhost #### Host where database is residing

db_user=#### name os database user

db_pass=#### password

db=nagioscenter #### database name

statusfile=/nagioscenter/dat-files/hostname/status.dat #### Location of status file

Step 4. Setup password-less SSH between your Nagios servers and Nagios Center Server.

Please refer to this tutorial for the same Password-Less SSH Login

Step 5. Create a script, to fetch the “status.dat” file and then run the parser on it.

# vi /nagioscenter/scripts/script.sh

#!/bin/bash

#### This will fetch the status.dat file from the remote host

scp root@:/usr/local/nagios/var/status.dat /nagioscenter/dat-files/hostname/status.dat

#### Run the python parser

/usr/bin/python /nagioscenter/daemon/nagcen_p.py -c /nagioscenter/daemon/nagcen.conf

Step 6. Make the script executable and put it in cron.

# chmod +x script.sh

# crontab -e

*/5 * * * * /bin/bash /nagioscenter/scripts/script.sh

Step 7. Copy “web-gui” directory into HTTP(Apache) Server’s path.

# cp -R /nagioscenter/web-gui /var/www/html

Step 8. Open following path in your browser

http://hostname/web-gui/nagcen

NOTE : You need to create a separate conf file for each host and the follow the steps 4 through 6.
If you enjoyed this post, make sure you subscribe to my RSS feed!!!!