1

I am trying to utilize the xport function of RRDs module in Perl to extract data from rrd files. However I am not having any luck finding a proper syntax to use the same. The official website only provides the following explanation. Please help if someone has used this module to do the same.

RRDs::xport exposes the rrdxport functionality and returns data with the following structure:

  my ($start,$end,$step,$cols,$names,$data) = RRDs::xport ...
  
  # $start : timestamp
  # $end   : timestamp
  # $step  : seconds
  # $cols  : number of returned columns
  # $names : arrayref with the names of the columns
  # $data  : arrayref of arrayrefs with the data (first index is time, second is column)
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174

1 Answers1

1

The various Perl function in the RRDs module take an array of parameters exactly as the commandline functions do.

So, for example,

@args = qw/--start now-1h --end now DEF:x=file.rrd:ds0:AVERAGE XPORT:x:out_bytes/;
($start,$end,$step,$cols,$names,$data) = RRDs::xport(@args);

Remember that you don't need to quote parameters that contain spaces - after all, they're already tokenised in the array.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39