Exemple procédural PECL/rrd

Exemple #1 Utilisation procédurale de rrd

<?php
$rrdFile = dirname(__FILE__) . "/speed.rrd";

//création d'un fichier rrd
rrd_create($rrdFile,
 array(
  "--start",920804400,
  "DS:speed:COUNTER:600:U:U",
  "RRA:AVERAGE:0.5:1:24",
  "RRA:AVERAGE:0.5:6:10"
  )
);

//Mise à jour d'un fichier rrd
rrd_update($rrdFile,
 array(
  "920804700:12345",
  "920805000:12357"
  )
);

//Affichage du graphique
rrd_graph(dirname(__FILE__) . "/speed.png",
 array(
  "--start", "920804400",
  "--end", "920808000",
  "--vertical-label", "m/s",
  "DEF:myspeed=$rrdFile:speed:AVERAGE",
  "CDEF:realspeed=myspeed,1000,*",
  "LINE2:realspeed#FF0000"
 )
);
?>

LoadingChargement en cours