[rrd-users] Re: RRD FETCH

Stephan Harren sh at abovenet.de
Wed Oct 2 14:09:47 MEST 2002

Mauro wrote:
> Hy, 
> i want make a script in Perl that fetch the last 15 minutes update and set it into distinct variable.
> In line command i write 
> rrdtool fetch ~/database/database.rrd AVERAGE -s end-15m
> but with a script how can i make this and how can i put this value into 3 variabile
> I think that it isn't difficult, but i'm a newbie.

use strict;
my $keys;
my @values;

@values=qx(/usr/local/rrdtool-1.0.39/bin/rrdtool fetch test.rrd AVERAGE 
-s -600 -e -300);
## Now you've got the values inside the array @values
chomp @values;
## Now no more \n
foreach $keys (@values) {
         print "$keys\n";
##Shows you the content of the array

If you don't know that much about perl, you can access the array with 
@values[0], @values[1], @values[2]

Best regards,


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