[英]PHP and rrd : rrd_xport function returning error
I'm trying to use the rrd_xport function to read data from an RRD file. 我正在尝试使用rrd_xport函数从RRD文件读取数据。 The function rrd_xport takes an array with 'options' as argument, but for the life of me I can't get it to work. 函数rrd_xport接受一个以'options'作为参数的数组,但是对我而言,我无法使其正常工作。 It doesn't help that the function is undocumented. 该函数没有文档说明没有帮助。 All I get out of it is "rrd_xport failed". 我得到的只是“ rrd_xport失败”。
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. 我已经从命令行运行了脚本,并且至少正在读取rrd文件。 Still no dice though. 仍然没有骰子。
Edit 2: 编辑2:
Solved the issue! 解决了这个问题! For future reference, the rrd_xport functions expects an array in the following format: 为了将来参考,rrd_xport函数期望使用以下格式的数组:
$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. XPORT和DEF区分大小写。 Hope it'll be useful to others! 希望对其他人有用!
Kind regards, 亲切的问候,
Dennis, i3D.net 丹尼斯,i3D.net
Solved the issue! 解决了这个问题! For future reference, the rrd_xport functions expects an array in the following format: 为了将来参考,rrd_xport函数期望使用以下格式的数组:
$options = Array(
"--step", "1",
"--start", "-1 year",
"--end", "now",
"DEF:out=<filename>:<name of your DS>:AVERAGE",
'XPORT:out:"<legend>"',
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.