[rrd-users] Question on rrdtool graph

Chang-Ping Hsiao Chang-PingH at corp.netzero.net
Fri Mar 16 23:34:05 MET 2001

    I am having a question on the rrdtool graph output for I don't know how
to select an RRA for the output.  I hope I can get some help from here, and
it is much appreciated.
    I am having different RRAs for an RRD.  All RRAs are using CF AVERAGE as
you can see below.  In the document for rrdtool graph, in the DEF: section,
it says "... The DEF call automatically chooses an RRA which contains CF
consolidated data in a resolution appropriate for the size of the graph to
be drawn."  Since I don't have enough data yet, I would have no way of
telling where or not I can retrieve data in the range at my will.
    Could anybody give me some hints?  Thanks.  :-)
sub create_rrd {        # create an RRD for a production box
        my $start = "--start $time_s";
        my $step  = "--step 3600";
        # heartbeat has to be big enough to allow meaningful data
        # i.e. step of 3600 needs approximately 7200 as the heartbreak
        my $ds1   = "DS:CPUidle:GAUGE:7200:0:100";
        my $ds2   = "DS:FreeMemory:GAUGE:7200:0:100";
        my $ds3   = "DS:Capacity:GAUGE:7200:0:100";
        my $ds4   = "DS:FreeSwapMemory:GAUGE:7200:0:100";
        my $rra1  = "RRA:AVERAGE:0.5:1:8784";   # daily
        my $rra2  = "RRA:AVERAGE:0.5:3:2928";   # weekly
        my $rra3  = "RRA:AVERAGE:0.5:6:1464";   # monthly
        my $rra4  = "RRA:AVERAGE:0.5:12:732";   # quarterly
        my $rra5  = "RRA:AVERAGE:0.5:24:366";   # yearly
        system "$rrdtool create $rrd $start $step $ds1 $ds2 $ds3 $ds4 $rra1
$rra2 $rra3 $rra4 $rra5";
sub graph_rrd { # create an image file
#       my $rrd = shift;
        my $start    = "--start $time_s";
        my $end      = "--end $time_e";
        my $filetype = "-a PNG";
        my $title    = "--title '$DATE $hostname'";
        my $upper    = "-u 100 -r";
        my $def1     = "DEF:CPUidle=$rrd:CPUidle:AVERAGE";
        my $def2     = "DEF:FreeMemory=$rrd:FreeMemory:AVERAGE";
        my $def3     = "DEF:Capacity=$rrd:Capacity:AVERAGE";
        my $def4     = "DEF:FreeSwapMemory=$rrd:FreeSwapMemory:AVERAGE";
        my $data1    = "LINE2:CPUidle#FF0000:'CPU Idle (%)'";
        my $data2    = "LINE2:FreeMemory#00FF00:'Free Memory (%)'";
        my $data3    = "LINE2:Capacity#0000FF:'Capacity of /add_app (%)'";
        my $data4    = "LINE2:FreeSwapMemory#FF00FF:'Free Swap Memory (%)'";
        printf "%25s.png  ", $hostname;
        system "$rrdtool graph $graph_dir/$DATE3/$hostname.png $start $end
$filetype \
                $title $upper $def1 $def2 $def3 $def4 $data1 $data2 $data3

Chang-Ping Hsiao

NetZero - Defenders of the Free World
Get your FREE Internet Access and Email at

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list