PHP 8.4.0 RC4 available for testing

rrd_fetch

(PECL rrd >= 0.9.0)

rrd_fetchFetch the data for graph as array

Beschreibung

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.

Parameter-Liste

filename

RRD database file name.

options

Array of options for resolution specification.

Rückgabewerte

Returns information about retrieved graph data.

add a note

User Contributed Notes 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