NagiosGrapher is an interesting tool used to process data and represent it in a graph form. The great thing about this program is that you can just about graph anything with it. NagiosGrapher saves data with RRDtool which will then generate the graph. The serviceextinfo will also generate information. This tutorial is the first in a series that shows you how to install it, next will show you how to set up specific graphs that you want to use.
NagiosGrapher willl allow you to graph most of the data that you are interested in evaluating. Here you can see the response time required to access a web server. No doubt you can view the actual statistics but it is not like seeing it in graph form.
There is considerable preparation you must do to be able to run Nagiosgrapher. In the end the work is worth.
The first tool you need to install is RRDtool. This tool allows the creation of graphs and functions as a unique database that overwrites old data as it reaches the starting point of a circular progression of data, thus is is called “Round Robin”. RRDtool calculates the rate of change from the value that it had previously. It uses timestamps on all of the information in order to due the necessary calculations.
You can either download the source code from http://oss.oetiker.ch/rrdtool/ or if you are using CentOS with the rpmforge repositories you can use yum to install it.
yum install rrdtool
Download Nagiosgrapher from sourceforge.net http://sourceforge.net/projects/nagiosgrapher/
Download NagiosGrapher-1.7.1.tar.gz and save it in /opt.
tar xzvf NagiosGrapher-1.7.1.tar.gz
The configure is built by autoconf so you will need to install that application before you can build Nagiosgrapher..
yum install autoconf
However, when you run configure it will access a file that will determine the layout of your distro. Here is a portion of the file called config.layout. This is one of the most important steps you will make, and if not done correctly will certainly case your system to fail. The paths that you see here are necessary for the program to find the resources that it needs. CHECK YOUR PATHS and verify that you have a setup that works for your distribution.
One this is edited you can see that the configure is performed with the template of your choosing.Once this is created you can run (use your template);
./configure –with-distro=redhat –with-layout=redhat
When it is complete run the make testdeps to check for dependencies.
Checking Data::Dumper … found
Checking File::Copy … found
Checking File::Basename … found
Checking Carp … found
Checking POSIX … found
Checking Time::HiRes … found
Checking Time::Local … found
Checking Storable … found
Checking GD … not installed!
Checking Image::Magick … not installed!
Checking RRDs … found
Checking CGI … found
Checking CGI::Carp … found
Checking IO::Handle … found
Checking URI::Escape … found
Checking Calendar::Simple … not installed!
make: *** [testdeps] Error 1
Install those packages not installed. No shortcuts here, on a CentOS distribution you will have specific problems with ImageMagick. So be careful to follow all of the steps.
yum install perl-GD
yum install ImageMagick
yum install ImageMagick-devel
yum install ImageMagick-perl
Use the perl shell to install some programs.
perl -MCPAN -e shell
If you are using rpmforge for the repositories for ImageMagic, you may have to update and then use this command to clean out the cache.
yum clean all
Then try to install your packages.
In order to allow nagios to write service perfdata you will need to edit nagios.cfg and the commands.cfg.
Edit the /etc/nagios/nagios.cfg:
command_line mv /var/log/nagios/service-perfdata /var/log/nagios/service-perfdata.$TIMET$
Check the log level
Default loglevel is set to 511 which means all, which is good for initial setup but could cause the logfile to grow quickly.
You may need to edit the script to point it to the correct location for the collect2.pl script. You also may have to create the nagios_grapher directory and make collect2.pl executable. On a CentOS system the following change had to be made to get it to work.
You may have to create the temporary directory for nagiosgrapher.
chown -R nagios:nagios /tmp/nagiosgrapher/
When you have restarted the nagios_grapher and nagios you should see the icon that represents Nagiosgrapher as you can see below. When you click on the icon
When you click the icon the browser opens which provides you several adjustments for your graphs.