About NagiosGrapher (v1.7.1)

NagiosGrapher is a tool that fits in with Nagios and adds graphing capabilities. Anything that is reported by a Nagios check can be graphed. The software is available from NagiosForge.

NagiosGrapher uses RRDTool to maintain its data, so space is not typically an issue – old data that falls off the graph is not kept any longer. For example, details reported every 15 minutes don’t have to be kept beyond about 48 hours (two days).

Graphs are available for daily, weekly, monthly, and yearly reports.

If you install NagiosGrapher under a Red Hat system, you may have to tell it to use layout “red_hat” (as the automatic tool may discover “redhat” instead of “red_hat”). Once installed, there are a number of files and directories created.


This is the startup script for NagiosGrapher. Make sure that the location of the daemon is set correctly; I had to change it to read this way:


The script as delivered does not support Red Hat’s chkconfig utility; add these lines to make it support chkconfig (just under the top line):

# chkconfig: 345 99 01
# description: NagiosGrapher

Then these commands need to be run to activate NagiosGrapher:

# chkconfig --add nagios_grapher
# chkconfig nagios_grapher on

Next time the system starts NagiosGrapher should start as well.


This is the general configuration file for NagiosGrapher itself. Perhaps the main thing to edit in this file is the option log_level (a bit-mapped value). This may be set high initially. I have it set to 63; it could probably be reduced further.


This is where the NagiosGrapher log is stored. The log details the operations of NagiosGrapher and the amount of detail is directly related to the log_level value in /etc/nagios/ngraph.ncfg.


These files are the performance data stored by Nagios. These are actually Nagios files (not NagiosGrapher files) but are read by NagiosGrapher to create its information. If these start building up, then NagiosGrapher is not reading them appropriately; it may be worthwhile to restart the service using the initiliazation script.


This directory contains the graph configuration. This configuration data is used to create the actual graphs. Many of these items will directly correlate with RRDTool commands and their options.

The defaults are set in nmgraph.ncfg, and the specific graphs can be found under the templates directory. To disable a graph configuration, just add the word _diabled on the end. Presumably this works because the file no longer ends in .ncfg (the standard NagiosGrapher configuration file ending). Likewise, to enable a disabled configuration remove the _disabled from the end of it (and make sure it ends in .ncfg.


This is a directory where NagiosGrapher stores appropriate configurations for each host that it reads from the performance data that it handles. These files are created automatically; to get the configuration to be loaded into Nagios, Nagios must be reloaded.


NagiosGrapher adds several files to this directory: udpecho, fifo_write.pl, fifo_write, collect2.pl, and the directory perl (which contains library files for NagiosGrapher). The most notable of these is collect2.pl: this is the actual program that runs and which scans the performance data for appropriate details.


NagiosGrapher adds several files to this directory as well: graphs.cgi, rrd2-graph.cgi, and rrd2-system.cgi.

I found that rrd2-system.cgi would not work: it would not present any PNG graphs. Adding this “fix” took care of the problem:

--- rrd2-system.cgi     2009-02-04 15:34:39.000000000 -0600
+++ /usr/lib/nagios/cgi/rrd2-system.cgi 2009-02-04 18:47:23.000000000 -0600
@@ -97,6 +97,7 @@
        $image_bin =~ s/^(\[.*?\])//;

+if (1 == 0) {
 if ($image_format eq 'PNG' && $code == 0 && !$only_graph && !$no_legend) {
        $ng->time_need(type => 'start');
        # Adding brand
@@ -128,6 +129,7 @@
                $image_bin = $blobs[0];
        $ng->time_need(type => 'stop', msg => 'Adding PerlMagick');

 # no buffered operations

It is rather a brute force fix, but I didn’t want to haggle with it. The fix just removes some stuff that isn’t needed for working operation of NagiosGrapher. It would have been nice to actually fix the problem, though.


This is where the RRDTool files are kept. All RRD files are kept in a directory by hostname, and each has a hexadecimal name with the extension .rrd. The seemingly random names are correlated to services by the file index.ngraph, also in this directory.

Powered by ScribeFire.