[rrd-users] PRINT to stdout - I give up - SOLVED
EA Kissack
lists2012 at kissack.co.uk
Sat Feb 11 11:08:22 CET 2012
On 06.02.2012 07:49, Steve Shipway wrote:
> Looking at your script, you are not retrieving the return value of
> RRDs::graph(), which is where the PRINT output goes. It does not go
> to stdout.
>
> You should do:
>
> @rv = RRDs::graph(@rrd);
>
> Then, @rv = ( @output, $xsize, $ysize ) for a graph image $xsize by
> $ysize, and @output is the array of all the PRINT output.
>
> See the manual for details:
> http://oss.oetiker.ch/rrdtool/prog/RRDs.en.html
>
> It might be more efficient though to use RRDs::fetch to collect
> averages for the various DSs and then do the multiplication and
> summation in your perl code, rather than go through all the graphing
> only to throw the image away...
>
> Steve
>
> Steve Shipway
> University of Auckland ITS
> UNIX Systems Design Lead
> s.shipway at auckland.ac.nz
> Ph: +64 9 373 7599 ext 86487
Steve
Thanks again. I couldn't get the first suggestion to work, but
RRDs::fetch did work after a bit of extra googling. I used:
sub nographtrial {
my ($start,$step,$names,$data) =
RRDs::fetch("/var/log/rrd/bwin.rrd", "AVERAGE", "-s -300", "-e -300") ;
print "Start: ", scalar localtime($start), " ($start)\n";
print "Step size: $step seconds\n";
print "DS names: ", join (", ", @$names)."\n";
print "Data points: ", $#$data + 1, "\n";
print "Data:\n";
for my $line (@$data) {
print " ", scalar localtime($start), " ($start) ";
$start += $step;
for my $val (@$line) {
printf "%12.1f ", $val;
}
print "\n";
}
}
and can now see the latest data points. I just need to remember, now,
why I wanted the data in the first place :-)
Allan
More information about the rrd-users
mailing list