NConf is a PHP based web-tool for configuring the Nagios monitoring software. The tool is based on PHP / MySQL.
Nagios is one of the best tool for monitoring & alerting, only missing part is web based configuration which is available in modern monitoring systems like cacti.
Using NConf & pnp4nagios Nagios becomes complete monitoring tool.
Features
- effortlessly maintain a distributed Nagios topology
- user-friendly web-GUI
- define host templates for your hosts
- define dependencies between hosts
- browse dependencies graphically
- choose from multiple authentication modes
- import existing Nagios configuration files
- easily expandable and customizable data schema
- perl database API
- customizable appearance
- runs on Linux / Apache / PHP / MySQL
Install Dependencies
CentOS
yum install httpd php php-mysql mysql-server
Ubuntu
apt-get install apache2 php5 php5-mysql mysql-server perl libdbi-perl libdbd-mysql-perl gawk
Installation.
STEP1
Install Nagios & ensure basic working.
STEP2
Download latest version from http://sourceforge.net/projects/nconf/files/
Extract NConf to /var/www/html/
cd /var/www/html tar zxvf /download/nconf-1.2.5-0.tgz |
Create MySql DB & create dbuser
mysqladmin –user=root create nconf mysql –user=root mysql GRANT ALL ON nconf.* TO nconf@localhost IDENTIFIED BY ‘nconf’; |
STEP3
Complete installation using NConf web based installation
http://serverip/nconf/
Following snaps are for guidance.
Configuration
Add Host
Define service to check
List of added Hosts
Click on Generate Nagios config to generate nagios configuration file.
By default nagios configuration is saved in nconf/output/.
You can change folder to nagios default configuration folder i.e /usr/local/nagios/etc/objects/.
You need to copy latest config from output folder to nagios actual configuration folder.
To make NConf work with Nagios add followings in /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/checkcommands.cfg cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg cfg_file=/usr/local/nagios/etc/objects/hosts.cfg cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg cfg_file=/usr/local/nagios/etc/objects/services.cfg cfg_file=/usr/local/nagios/etc/objects/servicegroups.cfg cfg_file=/usr/local/nagios/etc/objects/extended_service_info.cfg |
Remove check_local* commands from /usr/local/nagios/etc/objects/commands.cfg
& below all, as this all contains in checkcommands.cfg generated by nconf.
check_ftp check_hpjd check_snmp check_http check_ssh check_dhcp check_ping check_pop check_imap check_smtp check_tcp check_udp check_nt |
With the default installation, nconf generates config in /var/www/html/nconf/output/.
Below is very basic shell script I am using to copy config files to /usr/local/nagios/etc/objects/ only if /var/www/html/nconf/output/NagiosConfig.tgz is updated.
#!/bin/bash PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin alias cp=’cp’ if [ -d /tmp/nc ] then echo exists > /dev/null else mkdir /tmp/nc > /dev/null fi SOURCE=`ls /var/www/html/nconf/output/NagiosConfig.tgz -allh | gawk '{ print $6" "$7" "$8 }'` SOURCE1=`ls /var/www/html/nconf/output/NagiosConfig.tgz.back -allh | gawk '{ print $6" "$7" "$8 }'` if [ "$SOURCE" = "$SOURCE1" ] then echo no_change > /dev/null else cd /tmp/nc tar zxvf /var/www/html/nconf/output/NagiosConfig.tgz cp -rfva /tmp/nc/Default_collector/* /usr/local/nagios/etc/objects/ cp -rfva /tmp/nc/global/* /usr/local/nagios/etc/objects/ service nagios reload chmod 777 /usr/local/nagios/var/rw/nagios.cmd cp -rfva /var/www/html/nconf/output/NagiosConfig.tgz /var/www/html/nconf/output/NagiosConfig.tgz.back rm -rf /tmp/nc/* fi |
While writing this post latest versin of Nconf was 1.2.5, you may like to take a look at upgradation to 1.2.6

Pingback: Monitor your Blog / Web | LinuxReaders