略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: rrd_fetch

2024-12-21

rrd_fetch

(PECL rrd >= 0.9.0)

rrd_fetchFetch the data for graph as array

说明

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

Gets data for graph output from RRD database file as array. This function has same result as rrd_graph(), but fetched data are returned as array, no image file is created.

参数

filename

RRD database file name.

options

Array of options for resolution specification.

返回值

Returns information about retrieved graph data.

add a noteadd a note

User Contributed Notes 2 notes

up
-3
stephanecharette at gmail dot com
8 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";
}
?>
up
-38
ernestas at versme dot net
8 years ago
A few years ago, the extension was patched so that it would count options itself. But for me, it's buggy (it does not work with more than 3 arguments) and neither does work.

官方地址:https://www.php.net/manual/en/function.rrd-fetch.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3