NConf Installation & Configuration

nconf 300x255 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

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 Installation & Configuration

 NConf Installation & Configuration

 NConf Installation & Configuration

 NConf Installation & Configuration

 NConf Installation & Configuration

 NConf Installation & Configuration

Configuration

Add Host

 NConf Installation & Configuration

Define service to check

 NConf Installation & Configuration

List of added Hosts

 NConf Installation & Configuration

Click on Generate Nagios config to generate nagios configuration file.

 NConf Installation & Configuration

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

Related posts:

  1. Nagios Installation
  2. 10 Nagios Web Frontends
  3. ClamAV Installation
  4. OCSNG Server Setup on CentOS
  5. Install & Configure Cacti

Subscribe to LinuxReaders

rss twitter mail google buzz facbook stumble digg

2 Comments

  1. [...] all have utilities like Nagios & Nconf when it comes to monitor data center. But what about your own site / blog. Many professional [...]

  2. freelp says:

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

Leave a Reply