[rrd-users] programmatically create graphs

Munroe Sollog mus3 at Lehigh.EDU
Mon Jul 1 20:39:40 CEST 2013


Below is some basic code that generates a stacked graph from an RRD.
However, I want to generate a graph based on an array of RRDs.  The only
thing I have come up with is create a new RRD for every array and then
graph that.  There has to be a way given a hash of arrays:

$combined{$NameOfGraph} = @rrdfiles

that I can generate the equivalent of the below. the length of @rrdfiles
changes depending on the $NameOfGraph.



#!/usr/bin/perl -w
use strict;
use RRDs;
use Data::Dumper;

my $rrdfile = "exampleGraph.rdd";
my $NameOfGraph = "Example";
   RRDs::graph "$NameOfGraph",
    "--title", "APstats",
    "--start", "now-48h",
    "--width=300",
    "--height=75",
    "--vertical-label=Active Users",
    "DEF:a=$rrdfile:auth:MAX",
    "DEF:g=$rrdfile:guest:MAX",
    "VDEF:amax=a,LAST",
    "VDEF:aavg=a,AVERAGE",
    "VDEF:gmax=g,LAST",
    "VDEF:gavg=g,AVERAGE",
    "AREA:a#00C000:auth",
    "GPRINT:amax:%6.2lf %Susers",
    "AREA:g#00C0FF:guest:STACK",
    "GPRINT:gmax:%6.2lf %Susers",
    "--lazy",
    ;



More information about the rrd-users mailing list