[rrd-users] programmatically create graphs

Steve Shipway s.shipway at auckland.ac.nz
Tue Jul 2 07:49:32 CEST 2013


> 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.

Why not something like this?  You might want to dynamically define a line for the total, though.

my @args = ( $NameOfGraph,
     "--title", "APstats",
     "--start", "now-48h",
     "--width=300",
     "--height=75",
     "--vertical-label=Active Users", '--lazy' );
my $i = 0;
foreach ( @rrdfiles ) {
	push @args, (
     "DEF:a$i=$_:auth:MAX",
     "DEF:g$i=$_:guest:MAX",
     "VDEF:amax$i=a$i,LAST",
     "VDEF:aavg$i=a$i,AVERAGE",
     "VDEF:gmax$i=g$i,LAST",
     "VDEF:gavg$i=g$i,AVERAGE",
     "AREA:a$i#00C000:auth$i",
     "GPRINT:amax$i:\%6.2lf \%Susers",
     "AREA:g$i#00C0FF:guest$i:STACK",
     "GPRINT:gmax$i:\%6.2lf \%Susers");
	$i += 1;
}

RRDs::graph( @args );

Steve

Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 923 6487
Mobile: +64 (0)21 753 189
Email: s.shipway at auckland.ac.nz
 Please consider the environment before printing this e-mail : 打印本邮件,将减少一棵树存活的机会

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5900 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130702/290ac821/attachment.bin 


More information about the rrd-users mailing list