RRDTool

WebHome | UnixGeekTools | Geekfarm | About This Site

What is RRDtool?

If you know MRTG, you can think of RRDtool as a reimplementation of MRTGs graphing and logging features. Magnitudes faster and more flexible than you ever thought possible

RRD is the Acronym for Round Robin Database. RRD is a system to store and display time-series data (i.e. network bandwidth, machine-room temperature, server load average). It stores the data in a very compact way that will not expand over time, and it presents useful graphs by processing the data to enforce a certain data density. It can be used either via simple wrapper scripts (from shell or Perl) or via frontends that poll network devices and put a friendly user interface on it.

Some call it the industry standard data logging and graphing application.

Pointers

Command Line

rrdcreate

    rrdtool create temperature.rrd --step 300 DS:temp:GAUGE:600:-273:5000 \
            RRA:AVERAGE:0.5:1:1200 RRA:MIN:0.5:12:2400 RRA:MAX:0.5:12:2400 RRA:AVERAGE:0.5:12:2400

This sets up an RRD called temperature.rrd which accepts one temperature value every 300 seconds. If no new data is supplied for more than 600 seconds, the temperature becomes UNKNOWN. The minimum acceptable value is -273 and the maximum is 5000.

A few archives areas are also defined. The first stores the temperatures supplied for 100 hours (1200 * 300 seconds = 100 hours). The second RRA stores the minimum temperature recorded over every hour (12 * 300 seconds = 1 hour), for 100 days (2400 hours). The third and the fourth RRA's do the same for the maximum and average temperature, respectively.

update

    rrdtool update demo1.rrd N:3.44:3.15:U:23
    rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7

rrdgraph


rrdcgi


Backup and restore, import and export

    rrdtool dump original.rrd > data.xml
    scp data.xml servername:/tmp/
    rrdtool restore data.xml new.rrd


Perl

rrdpoller

RRDTool::OO

Other

- RRD::Simple
- RRD::Query
- RRD::Threshold
- Log::Log4perl::Appender::RRDs - Log to a RRDtool Archive
- POE::Component::RRDTool - POE interface to RRDtool

Front-ends

Cricket

cacti

Holt Winters

Cookbook

graphing maximums

- maximum

rrdtool graph graph.png \
    DEF:a=data.rrd:a:AVERAGE \
    VDEF:max=a,MAXIMUM \
    LINE2:a#00ff00:outgoing \
    LINE1:max#ff0000:maximum\\g \
    VRULE:max#ff0000 \
    GPRINT:max:"at %.2lf"

- 95%-tile

rrdtool graph.png \
    DEF:in=data.rrd:input \
    DEF:out=data.rrd:output \
    CDEF:base=in,out,MAX \
    VDEF:n95=base,95,PERCENT \
    AREA:in#0000b0:incoming \
    AREA:out#00ff0080:outgoing
    LINE1:base#000000:maximum \
    LINE1:n95#ff0000:"95%-tile "\
    GRPINT:n95:"at %.2lf %s"

match MRTG database

600 5-minute samples: 2 days and 2 hours
600 30-minute samples: 12.5 days
600 2-hour samples: 50 days
732 1-day samples: 732 days

600 samples of 5 minutes (2 days and 2 hours)
700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
775 samples of 2 hours (above + 50 days)
797 samples of 1 day (above + 732 days, rounded up to 797)

rrdtool create myrouter.rrd \
            DS:input:COUNTER:600:U:U \
            DS:output:COUNTER:600:U:U \
            RRA:AVERAGE:0.5:1:600 \
            RRA:AVERAGE:0.5:6:700 \
            RRA:AVERAGE:0.5:24:775 \
            RRA:AVERAGE:0.5:288:797 \
            RRA:MAX:0.5:1:600 \
            RRA:MAX:0.5:6:700 \
            RRA:MAX:0.5:24:775 \
            RRA:MAX:0.5:288:797





Updated Sat Jan 20, 2007 3:16 PM