Installing NagVis for use with Nagios

This was mainly a reference sheet should I need to install again in future so please excuse any mistakes. I installed on a CentOS 5 virtual machine that was running Groundwork Community Edition 6.0 and I subsequently realised that the Apache and PHP modules were already installed within the Groundwork environment.

Nagvis in this situation can be installed instead from

There are excellent instructions and in all it takes around 5 minutes to install from start to finish!

Installing NagVis for use with Nagios


NagVis requires a number of preinstalled programs to function correctly.

MKLivestatus is an Event Broker Module for Nagios which serves a unix socket which allows NagVis to connect to gather live status information efficiently

Apache webserver with PHP support. NagVis recommends Apache as it is a web based application and thus it requires a webserver with PHP support to run NagVis successfully.

Graphviz for the automap feature.

Used this really good guide to assist in the installation of Apache and PHP

Install MK Livestatus

· Download mk-livestatus-1.1.6p1.tar.gz from

· Save to a memorable place ie) /tmp

· Unpack and configure

tar xzf mk-livestatus-1.1.6p1.tar.gz

· Compile using

cd mk-livestatus-1.1.6p1

At this point I got an error:

checking for C++ compiler default output file name…

configure: error: C++ compiler cannot create executables

See `config.log’ for more details.

· To resolve I ran #yum install gcc-c++ which reinstalled the relevant libraries

· # make install

· Added the following to the nagios.cfg file

broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/lib/nagios/rw/live


· Also had to create /var/lib/nagios/rw/ directory as it didn’t exist and add permissions for access and create to the directory for ‘Others’

Install Apache with DSO support

The advantage of building Apache with DSO support is that you can add modules to the webserver dynamically and without having to rebuild Apache each time you wish to add a module.

· Download the latest version of Apache


· Unpack the source code

tar zxf httpd-2.2.16.gz

· cd httpd-2.2.16

· make clean

./configure ’
–prefix=/usr/local/apache ’
–enable-shared=max ’
–enable-module=rewrite ’

· Once the configure process has completed
make && make install

Install PHP

· wget

· Go to the file location and extract

tar zxf php-5.3.3.tar.gz

· cd /usr/local/src/php-5.3.3

· ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs

· make && make install

Install additional PHP modules

yum install <module name>

§ php-gd

§ php-gettext

§ php-mbstring

§ php-session

§ php-json (Builtin since PHP 5.2)

§ php-pdo

§ pdo-sqlite

Couldn’t find pdo-sqlite so installed sqlite php5- sqlite” instead.

· Create the php.ini file

cp php.ini-production /usr/local/php/lib/php.ini

· Edit the Apache httpd.conf file and check that the following 2 lines are present. If not then add them

LoadModule php5_module modules/
AddType application/x-httpd-php .php

· Create a startup script for Apache

ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache

· Set auto start up for runlevel 3

ln -s /etc/rc.d/init.d/apache /etc/rc.d/rc3.d/S90apache

· Start the Apache daemon

/etc/rc.d/init.d/apache start

· Check whether httpd is running

ps -ef

Installing GraphViz

Taken from _linux_rhel.php

· The easiest way to install and maintain graphviz on RHEL or Centos is to use yum. To set up yum, download the graphviz-rhel.repo file and save it (as root) in/etc/yum.repos.d/

· Then you can (as root) type:

yum list available ’graphviz*’

yum install ’graphviz*’

When I followed these instructions I received a number of errors:

graphviz-php-2.16-1.el5.i386 from graphviz-stable has depsolving problems

–> Missing Dependency: graphviz = 2.16-1.el5 is needed by package graphviz-php-2.16-1.el5.i386 (graphviz-stable)

I used the CentOS Package Manager to locate the graphviz-php-2.16-1.el5.i386 file which also installs a number of dependencies but this didn’t resolve the issue.

After a little searching found that this syntax worked:

yum install graphviz* -x graphviz-php

Installing NagVis

· Download the latest version of NagVis from

· Unpack it in a memorable location:

tar xvzf nagvis-1.5*.tar.gz

· Find the root of the NagVis directory and make the installer executable

chmod +x

· Finally, run the installer


I thought the hard part was over but there are a number of options that require attention during the actual installation. I found that I needed to specify the actual location of Nagios as it was part of the /usr/local/groundwork directory as I am using Nagios via Groundwork. The second issue I had was with MKlivestatus as the install was trying to retrieve socket information from the wrong location and stated that the socket was ‘missing’. To find the correct socket restart nagios and then view the Nagios.log file to see the definitive socket location.

Configuring NagVis

· First step is to configure the nagvis.ini.php file that holds all the configuration settings for NagVis. You can copy the example file to the main file:

cp etc/nagvis.ini.php-sample etc/nagvis.ini.php

· Settings are configured by default but if you wish to make a change to the entries in the file they will always override the default settings. More information is available here

cp etc/apache2-nagvis.conf-sample /usr/local/groundwork/apache2/conf.d/apache2-nagvis.conf

grep -e ’^User’ /usr/local/groundwork/apache2/conf/*.conf

chown nagios:nagios /usr/local/nagvis -R

chmod 664 /usr/local/nagvis/etc/nagvis.ini.php

chmod 775 /usr/local/nagvis/etc/maps

chmod 664 /usr/local/nagvis/etc/maps/*

chmod 775 /usr/local/nagvis/etc/automaps

chmod 664 /usr/local/nagvis/etc/automaps/*

chmod 775 /usr/local/nagvis/share/userfiles/images/maps

chmod 664 /usr/local/nagvis/share/userfiles/images/maps/*

chmod 775 /usr/local/nagvis/var

chmod 664 /usr/local/nagvis/var/*

chmod 775 /usr/local/nagvis/var/tmpl/cache


One thought on “Installing NagVis for use with Nagios

  1. Thanks for your post. The “yum install gcc-c++” really helped troubleshoot the problem.
    In MK Livestatus you seem to be missing the ./configure line you used.
    You have
    Compile using
    cd mk-livestatus-1.1.6p1
    At this point I got an error:

    But do not mention any configure or make commands

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s