[rrd-users] programmatically create graphs
Steve Shipway
s.shipway at auckland.ac.nz
Wed Jul 3 10:34:32 CEST 2013
>Sorry for the long post. I did what you said and built an array of all
>of the arguments. However, this results in an empty graph. While the
>individual graphs (one for each RRD) definitely has data. Below is a
>dump of the array I'm passing to RRD::graph
...
>'CDEF:atot=a0,a1,+,a2,+,a3,+,a4,+,a5,+,a6,+,a7,+,a8,+,a9,+,a10,+,a11,+,a12,+,a13,+,a14,+,a15,+,a16,+,a17,+,a18,+,a19,+,a20,+,a21,+,a22,+,a23,+,a24,+,a25,+,a26,+';
You might like to consider using ADDNAN instead of +, since if ANY of the a1...a26 vars is unknown, atot will be unknown and so not display - probably what is happening.
Steve
Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.shipway at auckland.ac.nz
Ph: +64 9 373 7599 ext 86487
________________________________________
From: rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch [rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch] on behalf of Munroe Sollog [mus3 at Lehigh.EDU]
Sent: Wednesday, 3 July 2013 2:50 a.m.
Cc: 'rrd-users at lists.oetiker.ch'
Subject: Re: [rrd-users] programmatically create graphs
Sorry for the long post. I did what you said and built an array of all
of the arguments. However, this results in an empty graph. While the
individual graphs (one for each RRD) definitely has data. Below is a
dump of the array I'm passing to RRD::graph
$VAR1 = '/home/arubav2/graphs/building/EWFMA.48hr.png';
$VAR2 = '--title';
$VAR3 = 'APstats';
$VAR4 = '--start';
$VAR5 = 'now-48h';
$VAR6 = '--width=600';
$VAR7 = '--height=150';
$VAR8 = '--vertical-label=Active Users';
$VAR9 =
'DEF:a0=/home/arubav2/data/aps/EWFMA-rm750-air-duct-middle.rrd:auth:MAX';
$VAR10 =
'DEF:g0=/home/arubav2/data/aps/EWFMA-rm750-air-duct-middle.rrd:guest:MAX';
$VAR11 = 'DEF:a1=/home/arubav2/data/aps/EWFMA-Atrium.rrd:auth:MAX';
$VAR12 = 'DEF:g1=/home/arubav2/data/aps/EWFMA-Atrium.rrd:guest:MAX';
$VAR13 = 'DEF:a2=/home/arubav2/data/aps/EWFMA-rm650-E.rrd:auth:MAX';
$VAR14 = 'DEF:g2=/home/arubav2/data/aps/EWFMA-rm650-E.rrd:guest:MAX';
$VAR15 = 'DEF:a3=/home/arubav2/data/aps/EWFMA-rm412.rrd:auth:MAX';
$VAR16 = 'DEF:g3=/home/arubav2/data/aps/EWFMA-rm412.rrd:guest:MAX';
$VAR17 = 'DEF:a4=/home/arubav2/data/aps/EWFMA-rm395.rrd:auth:MAX';
$VAR18 = 'DEF:g4=/home/arubav2/data/aps/EWFMA-rm395.rrd:guest:MAX';
$VAR19 = 'DEF:a5=/home/arubav2/data/aps/EWFMA-rm753.rrd:auth:MAX';
$VAR20 = 'DEF:g5=/home/arubav2/data/aps/EWFMA-rm753.rrd:guest:MAX';
$VAR21 = 'DEF:a6=/home/arubav2/data/aps/EWFMA-on-pillar.rrd:auth:MAX';
$VAR22 = 'DEF:g6=/home/arubav2/data/aps/EWFMA-on-pillar.rrd:guest:MAX';
$VAR23 = 'DEF:a7=/home/arubav2/data/aps/EWFMA-rm750-W.rrd:auth:MAX';
$VAR24 = 'DEF:g7=/home/arubav2/data/aps/EWFMA-rm750-W.rrd:guest:MAX';
$VAR25 =
'DEF:a8=/home/arubav2/data/aps/EWFMA-rm450-glass-corner.rrd:auth:MAX';
$VAR26 =
'DEF:g8=/home/arubav2/data/aps/EWFMA-rm450-glass-corner.rrd:guest:MAX';
$VAR27 = 'DEF:a9=/home/arubav2/data/aps/EWFMA-Outside-rm467.rrd:auth:MAX';
$VAR28 = 'DEF:g9=/home/arubav2/data/aps/EWFMA-Outside-rm467.rrd:guest:MAX';
$VAR29 =
'DEF:a10=/home/arubav2/data/aps/EWFMA-outside-rm505EC.rrd:auth:MAX';
$VAR30 =
'DEF:g10=/home/arubav2/data/aps/EWFMA-outside-rm505EC.rrd:guest:MAX';
$VAR31 =
'DEF:a11=/home/arubav2/data/aps/EWFMA-outside-rm-605EC.rrd:auth:MAX';
$VAR32 =
'DEF:g11=/home/arubav2/data/aps/EWFMA-outside-rm-605EC.rrd:guest:MAX';
$VAR33 = 'DEF:a12=/home/arubav2/data/aps/EWFMA-rm650-W.rrd:auth:MAX';
$VAR34 = 'DEF:g12=/home/arubav2/data/aps/EWFMA-rm650-W.rrd:guest:MAX';
$VAR35 = 'DEF:a13=/home/arubav2/data/aps/EWFMA-rm750-E.rrd:auth:MAX';
$VAR36 = 'DEF:g13=/home/arubav2/data/aps/EWFMA-rm750-E.rrd:guest:MAX';
$VAR37 = 'DEF:a14=/home/arubav2/data/aps/EWFMA-rm449.rrd:auth:MAX';
$VAR38 = 'DEF:g14=/home/arubav2/data/aps/EWFMA-rm449.rrd:guest:MAX';
$VAR39 = 'DEF:a15=/home/arubav2/data/aps/EWFMA-rm625.rrd:auth:MAX';
$VAR40 = 'DEF:g15=/home/arubav2/data/aps/EWFMA-rm625.rrd:guest:MAX';
$VAR41 = 'DEF:a16=/home/arubav2/data/aps/EWFMA-study-room.rrd:auth:MAX';
$VAR42 = 'DEF:g16=/home/arubav2/data/aps/EWFMA-study-room.rrd:guest:MAX';
$VAR43 =
'DEF:a17=/home/arubav2/data/aps/EWFMA-rm650-air-duct-farside.rrd:auth:MAX';
$VAR44 =
'DEF:g17=/home/arubav2/data/aps/EWFMA-rm650-air-duct-farside.rrd:guest:MAX';
$VAR45 = 'DEF:a18=/home/arubav2/data/aps/EWFMA-outside-rm523.rrd:auth:MAX';
$VAR46 = 'DEF:g18=/home/arubav2/data/aps/EWFMA-outside-rm523.rrd:guest:MAX';
$VAR47 =
'DEF:a19=/home/arubav2/data/aps/EWFMA-outside-rm528TC.rrd:auth:MAX';
$VAR48 =
'DEF:g19=/home/arubav2/data/aps/EWFMA-outside-rm528TC.rrd:guest:MAX';
$VAR49 =
'DEF:a20=/home/arubav2/data/aps/EWFMA-rm750-air-duct-farside.rrd:auth:MAX';
$VAR50 =
'DEF:g20=/home/arubav2/data/aps/EWFMA-rm750-air-duct-farside.rrd:guest:MAX';
$VAR51 =
'DEF:a21=/home/arubav2/data/aps/EWFMA-rm550-air-duct-farside.rrd:auth:MAX';
$VAR52 =
'DEF:g21=/home/arubav2/data/aps/EWFMA-rm550-air-duct-farside.rrd:guest:MAX';
$VAR53 =
'DEF:a22=/home/arubav2/data/aps/EWFMA-rm550-air-duct-middle.rrd:auth:MAX';
$VAR54 =
'DEF:g22=/home/arubav2/data/aps/EWFMA-rm550-air-duct-middle.rrd:guest:MAX';
$VAR55 =
'DEF:a23=/home/arubav2/data/aps/EWFMA-rm650-air-duct-middle.rrd:auth:MAX';
$VAR56 =
'DEF:g23=/home/arubav2/data/aps/EWFMA-rm650-air-duct-middle.rrd:guest:MAX';
$VAR57 = 'DEF:a24=/home/arubav2/data/aps/EWFMA-rm550-W.rrd:auth:MAX';
$VAR58 = 'DEF:g24=/home/arubav2/data/aps/EWFMA-rm550-W.rrd:guest:MAX';
$VAR59 = 'DEF:a25=/home/arubav2/data/aps/EWFMA-rm550-E.rrd:auth:MAX';
$VAR60 = 'DEF:g25=/home/arubav2/data/aps/EWFMA-rm550-E.rrd:guest:MAX';
$VAR61 = 'DEF:a26=/home/arubav2/data/aps/EWFMA-rm634.rrd:auth:MAX';
$VAR62 = 'DEF:g26=/home/arubav2/data/aps/EWFMA-rm634.rrd:guest:MAX';
$VAR63 =
'CDEF:atot=a0,a1,+,a2,+,a3,+,a4,+,a5,+,a6,+,a7,+,a8,+,a9,+,a10,+,a11,+,a12,+,a13,+,a14,+,a15,+,a16,+,a17,+,a18,+,a19,+,a20,+,a21,+,a22,+,a23,+,a24,+,a25,+,a26,+';
$VAR64 =
'CDEF:gtot=g0,g1,+,g2,+,g3,+,g4,+,g5,+,g6,+,g7,+,g8,+,g9,+,g10,+,g11,+,g12,+,g13,+,g14,+,g15,+,g16,+,g17,+,g18,+,g19,+,g20,+,g21,+,g22,+,g23,+,g24,+,g25,+,g26,+';
$VAR65 = 'VDEF:a=atot,LAST';
$VAR66 = 'VDEF:g=gtot,LAST';
$VAR67 = 'AREA:atot#00C000:auth';
$VAR68 = 'GPRINT:a:%6.2lf %Susers';
$VAR69 = 'AREA:gtot#00C0FF:guest:STACK';
$VAR70 = 'GPRINT:g:%6.2lf %Susers';
On 07/02/2013 01:49 AM, Steve Shipway wrote:
>> 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 : 打印本邮件,将减少一棵树存活的机会
>
>
>
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
--
Munroe Sollog
LTS - Network Analyst
x85002
_______________________________________________
rrd-users mailing list
rrd-users at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
More information about the rrd-users
mailing list