Graphics Php

$rrdname = "/full/path/to/rrdfile.rrd";
$daygraph = "gifday.gif";
$weekgraph = "gifweek.gif";
$monthgraph= "gifmonth.gif";
$yeargraph = "gifyear.gif";
/* I don't suggest you to modify listing code below. */
$daystart = "-2000m";
$weekstart = "-12000m";
$monthstart = "-2880000";
$yearstart = "-34560000";
gambar($daygraph, $rrdname, $daystart);
echo "

Daily graph";
echo "

";
gambar($weekgraph, $rrdname, $weekstart);
echo "

Weekly graph";
echo "

";
gambar($monthgraph, $rrdname, $monthstart);
echo "

Monthly graph";
echo "

";
gambar($yeargraph,$rrdname,$yearstart);
echo "

Yearly graph";
echo "

";
function gambar($gif,$rrd, $start)
{
$comm="rrdtool graph images/$gif --alt-y-grid --lazy -c MGRID#ee0000 -c GRID#000000 --
start $start -
-end now DEF:data0=$rrd:ds0:AVERAGE DEF:data1=$rrd:ds1:AVERAGE
\"CDEF:input=data0,8,*\" \"CDEF:output=data1,8,*\" CDEF:ijo=input,100
,GT,input,0,IF AREA:ijo#00BF00:\"Incoming traffic in Bits per second\\l\"
LINE2:output#0000FF:\"Outgoing traffic in Bits per second
\\l\" GPRINT:input:MAX:\"Maximal In\: %9.0lf bits.\" GPRINT:output:MAX:\"Maximal Out\: %9.0lf
bits.\\l\" GPRINT:input:AVERAGE:\"Aver
age In\: %9.0lf bits.\" GPRINT:output:AVERAGE:\"Average Out\: %9.0lf bits.\\l\"
GPRINT:input:LAST:\"Current In\: %9.0lf bits.\" GPRI
NT:output:LAST:\"Current Out\: %9.0lf bits.\\l\"";
exec($comm);
}
?>