Home > Linux > NConf Installation & Configuration

NConf Installation & Configuration

nconf

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

Read More

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.

nconf_install1

nconf_install2

nconf_install3

nconf_install4

nconf_install5

nconf_install6

Configuration

Add Host

nconf_config1

Define service to check

nconf_config2

List of added Hosts

nconf_config3

Click on Generate Nagios config to generate nagios configuration file.

nconf_config4

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/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
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

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Buzz
  • Reddit
  • BlinkList
  • del.icio.us
  • DZone
  • email
  • IndianPad
  • LinkedIn
  • Live
  • Print
  • Technorati
  1. January 26th, 2010 at 09:31 | #1

    can use “inotify” sync this cfg files to the “/usr/local/nagios/etc/objects/” real time

  1. December 11th, 2009 at 23:36 | #1