Using rrdcached with Nagios XI

Document Sample
Using rrdcached with Nagios XI Powered By Docstoc
					  Using rrdcached with Nagios XI

                                            The Industry Standard in IT Infrastructure Monitoring

This document describes how to enable rrdcached with Nagios XI as a step to improve performance and reduce disk I/O on large

Target Audience
This document is intended for use by Nagios XI Administrators.

What is rrdcached?
The full documentation on rrdcached is located at the following URL:

rrdcached is a daemon that receives updates to existing RRD files, accumulates them and, if enough have been received or a defined
time has passed, writes the updates to the RRD file. A flush command may be used to force writing of values to disk, so that graphing
facilities and similar can work with up-to-date data.

On a Nagios XI install, rrdcached collects host and service performance data and then flushes it to the appropriate rrd files at a
specified interval. This reduces the amount of disk activity needed to keep a large number of rrd files current for performance graphs.
This configuration is useful for large monitoring environments where there are more than 1000 check results returning performance
data every minute, or from systems suffering from a performance loss due to I/O Wait.

rrdcached Installation CentOS/RHEL 5.X

RHEL/CentOS 5.x should already have rrdcached installed from the rrdtool 1.4.4 package that is installed on the system, but this can
be verified by running:

service rrdcached start

If rrdcached starts successfully, skip ahead to the “Setting Up the rrdcached Daemon” section.

rrdcached Installation CentOS/RHEL 6.X
For RHEL/CentOS 6.x installations, the rrdtool package will need to be manually updated in order to utilize rrdcached. At the time of
writing this document, the rrd packages in the rpmforge repos contain an older version of rrdtool than the CentOS 5 repo. The following
steps will account for these discrepancies.

First we'll install a few prerequisites

yum install -y libxml2 libxml2-devel pango-devel

Then we'll download the rrdtool.1.4.4 tarball and install from source.
tar zxf rrdtool-1.4.4.tar.gz
cd rrdtool-1.4.4
./configure --bindir=/usr/bin
make clean
make install

                       Nagios Enterprises, LLC   US: 1-888-NAGIOS-1       Web:                                     Page 1
                       P.O. Box 8154             Int'l: +1 651-204-9102   Email:
                       Saint Paul, MN 55108      Fax: +1 651-204-9103
                                                                                                             Revision 1.0 – November, 2011
  Using rrdcached with Nagios XI
Download and copy over the rrdcached init script.

cd /tmp
chmod +x rrdcached
mv rrdcached /etc/init.d/
mkdir /var/rrdtool
chown nagios:nagios /var/rrdtool

Remove outdated perl package.

yum remove -y rrdtool-perl

Setting Up The rrdcached Daemon
Open the /etc/sysconfig/rrdcached config file in your preferred text editor. If it doesn't not exist, go ahead and create it.

rrdcached options:
        -l       Location of the rrdcached unix socket
        -F       Tells rrdcached to flush all data to the rrdfiles anytime it shuts down
        -s       The authorized user or group for rrdcached
        -m       Socket file permissions in octal format
        -w       Data is written to disk every X number of seconds
        -z       Random offset delay. The write to files will be spread out over X number of seconds. Should be less than -w
        -j       The temp directory for rrdcached storage
        -b       Binary cached for the rrdcached daemon
        -P       Recognize commands for rrdcached

Example settings in /etc/sysconfig/rrdcached

# Settings for rrdcached
OPTIONS="-l unix:/var/rrdtool/rrdcached/rrdcached.sock -F -s nagios -m 0660 -w 900 -z 90 -j /tmp/
-b /var/rrdtool/rrdcached -P FLUSH,PENDING"

From the above settings, rrdtool will now cache data for 15 minutes (-w 900) before writing to files over a 90 second interval (-z 90).
Note: This will create a 15 minute lag time in performance graphs viewed in the web interface. Save the file and close.

Restart the service to apply the new configuration settings.

  service rrdcached restart

Now lets add rrdcached to the list of services launched on startup.

  chkconfig --add rrdcached
  chkconfig --level 35 rrdcached on
  chkconfig –-level 1246 rrdcached off

                      Nagios Enterprises, LLC   US: 1-888-NAGIOS-1        Web:                                       Page 2
                      P.O. Box 8154             Int'l: +1 651-204-9102    Email:
                      Saint Paul, MN 55108      Fax: +1 651-204-9103
                                                                                                               Revision 1.0 – November, 2011
  Using rrdcached with Nagios XI

Setting Up PNP To Utilize rrdcached
Open the /usr/local/nagios/etc/pnp/process_perfdata.cfg file in your preferred text editor. Scroll down to the bottom of the
configuration file and locate the line containing the RRD_DAEMON_OPTS option. Uncomment the RRD_DAEMON_OPTS line and update
the file location to point to your rrdcached socket.

RRD_DAEMON_OPTS = unix:/var/rrdtool/rrdcached/rrdcached.sock

Now restart the npcd daemon for the changes to take effect.

  service npcd restart

Verifying The Setup
Now to verify that the daemon is working correctly, check the location of the directory that was specified with the -j option in the
/etc/sysconfig/rrdcached file. In the example above, the journaling directory is /tmp. There should be an rrd.journal file there with a
recent timestamp matching the last time the rrdcached service was restarted.

[root@BENCHMARK tmp]$ ll
total 32916
-rw-r--r-- 1 nagios users               196608 Nov       9 09:20 rrd.journal.1320851372.658350

The PNP changes can be verified by looking at a performance graph in the interface after the number of seconds specified by the -w
directive in the /etc/sysconfig/rrdcached file. In the example above, a user would need to wait for at least 15 minutes before verifying
that new performance data was correctly being written to the rrdfiles. Rrdcached can be disabled at any time by commenting out the
RRD_DAEMON_OPTS in the /usr/local/nagios/etc/pnp/process_perfdata.conf file.

                      Nagios Enterprises, LLC   US: 1-888-NAGIOS-1       Web:                                        Page 3
                      P.O. Box 8154             Int'l: +1 651-204-9102   Email:
                      Saint Paul, MN 55108      Fax: +1 651-204-9103
                                                                                                               Revision 1.0 – November, 2011

Shared By: