Calculations of RRD data

Jim Avery jim at jimavery.me.uk
Mon Aug 9 17:34:53 CEST 2010


On 8 August 2010 19:47, Stephen H. Dawson <service at shdawson.com> wrote:
> Hi,
>
>
> Not sure if this is the correct place to ask this question, but starting
> here.
>
> We use Nagios for lots of monitoring, and store that data in the RRD
> database.  We graph that data.  Life is good.  We have some odd thoughts
> about "what if" scenarios, where we need to further review the data in the
> RRD database.  Simple arithmetic calculations of minus, division, and then
> some averaging of some of those minus and division outputs.
>
> We really do not want to put the monitored data into a SQL database.  How
> (hopefully) does one do arithmetic calculations of data in an RRD database,
> please?


I find DRRAW really useful for that sort of thing.  As Marc said, you
can use rrdgraph to do these things - DRRAW just makes it easier.

For a version which was developed to add functionality specific to
PNP4Nagios, see:
http://www.semintelligent.com/blog/articles/39/pnp-aware-version-of-drraw-released

I'm not sure if this was ever rolled in to the main DRRAW release
which is at http://web.taranis.org/drraw/


You can also use the rrdtool xport utility to export information from
an rrd to a .xml, doing some calc on it in the process, for example
here's one where I get data from three different rrd files:



#!/bin/sh

rrdtool xport  \
  --start "end -14 day" \
  --end "07/12/2010 00:00" \
  --step  3600 \
  --enumds \
  DEF:a=/usr/local/nagios/share/perfdata//chp-p15/Load.rrd:1:AVERAGE \
  DEF:e=/usr/local/nagios/share/perfdata//chp-p16/Load.rrd:1:AVERAGE \
  DEF:b=/usr/local/nagios/share/perfdata//chp-p15/BIS_count_tBPInstances.rrd:1:MIN
\
  DEF:c=/usr/local/nagios/share/perfdata//chp-p15/BIS_count_tBPInstances.rrd:1:MAX
\
  CDEF:d=c,b,- \
  XPORT:a:"Load Average App" \
  XPORT:e:"Load Average DB" \
  XPORT:d:"tBPInstances Delta" \
  XPORT:b:"tBPInstances Min" \
  XPORT:c:"tBPInstances Max" > 14days-to-20100623.xml


The xml file can then be easily imported in to Microsoft Excel so you
can do futher maths on it if you wish.

See:

http://oss.oetiker.ch/rrdtool/doc/rrdxport.en.html


Another neat thing you can do is use rrdcgi to publish graphs on the web.  See:

http://oss.oetiker.ch/rrdtool/doc/rrdcgi.en.html

I found the learning curve for all this lot fairly steep, but using
drraw helps (as it can show you what rrd commands it is building) and
the rewards are great.

hth,

Jim

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list