rrd_fetch

(PECL rrd >= 0.9.0)

rrd_fetch获取图表数据数组

说明

rrd_fetch(string $filename, array $options): array

从 RRD 数据库文件获取图表输出的数据数组。此函数与 rrd_graph() 结果相同,但仅返回数据数组,不会生成图像文件。

参数

filename

RRD 数据库文件名。

options

数据间隔规范的数组选项。

返回值

返回检索到的相关图形信息数据。

添加备注

用户贡献的备注 1 note

up
-5
stephanecharette at gmail dot com
11 years ago
For example, this worked for me:

<?php
$result
= rrd_fetch( "mydata.rrd", array( "AVERAGE", "--resolution", "60", "--start", "-1d", "--end", "start+1h" ) );
?>

This will fetch all fields. You then have to use something like this to get to a specified rrd field:

<?php
foreach ( $result["data"]["myfield"] as $key => $value )
{
echo
"At timestamp $key, the value for myfield is $value.\n";
}
?>
To Top