I'm trying to use the rrd_xport function to read data from an RRD file. The function rrd_xport takes an array with 'options' as argument, but for the life of me I can't get it to work. It doesn't help that the function is undocumented. All I get out of it is "rrd_xport failed".
Can anyone provide me with a simple example of what it expects in the array ?
Here is a code snippet:
$options = Array(
"start" => "now-1d",
"end" => "now",
"step" => 1,
"def" => Array(
"vname" => 'connections_vname',
"file" => 'data.rrd',
"dsname" => 'connections',
"cfunc" => 'MAX'
),
"xport" => Array(
'vname' => 'connections_vname',
'legend' => 'legend'
),
);
print_r(rrd_xport($options));
Edit:
It appears it is expecting the array to be in a format like this:
$options = array(
"--step", "60",
"--start", "-1 year",
"DEF:out=data.rrd:outoctets:AVERAGE",
'XPORT:out:"foo"',
);
I've straced the script running from the command-line and atleast it's reading the rrd file now. Still no dice though.
Edit 2:
Solved the issue! For future reference, the rrd_xport functions expects an array in the following format:
$options = Array(
"--step", "1",
"--start", "-1 year",
"--end", "now",
"DEF:out=<filename>:<name of your DS>:AVERAGE",
'XPORT:out:"<legend>"',
);
XPORT and DEF are case sensitive. Hope it'll be useful to others!
Kind regards,
Dennis, i3D.net
Solved the issue! For future reference, the rrd_xport functions expects an array in the following format: