NConf Installation & Configuration
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
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
And remove check_local* commands from /usr/local/nagios/etc/objects/commands.cfg
& 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 as this all contains in checkcommands.cfg generated by nconf.
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/binalias cp=’cp’
if [ -d /tmp/nc ]
then
echo exists > /dev/null
else
mkdir /tmp/nc > /dev/null
fiSOURCE=`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
cp -rfva /var/www/html/nconf/output/NagiosConfig.tgz /var/www/html/nconf/output/NagiosConfig.tgz.back
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
Related posts:



[...] all have utilities like Nagios & Nconf when it comes to monitor data center. But what about your own site / blog. Many professional [...]
can use “inotify” sync this cfg files to the “/usr/local/nagios/etc/objects/” real time