PHP 8.3.4 Released!

rrd_fetch

(PECL rrd >= 0.9.0)

rrd_fetchRecuperar los datos de gráfico como un array

Descripción

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

Obtiene datos para la salida gráfica del archivo desde la base de datos RRD como un array. Esta función tiene el mismo resultado que rrd_graph(), pero los datos obtenidos son devueltos como una matriz, no se crea el archivo de imagen.

Parámetros

filename

Nombre de archivo de la base de datos RRD.

options

Array de opciones para la resolución solicitada.

Valores devueltos

Devuelve información acerca de los datos del gráfico recuperados.

add a note

User Contributed Notes 2 notes

up
-5
stephanecharette at gmail dot com
10 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
-45
ernestas at versme dot net
10 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.
To Top