[rrd-users] No graphs
Alegria, Luis
lalegria at ics-canada.net
Wed Jan 31 06:12:04 CET 2007
Hi,
I'm trying to generate my own graphs using php, but I get nothing. can anyone shed a light. Here goe the code.
<?
function gambar($gif,$rrd,$start)
{
$path_rrdbase_dir = "c:\\inetpub\\wwwroot\\rrds";
$command="c:\\rrdtool\\rrdtool.exe graph graphs/test.png -s -6h -a PNG -A -M -L 4 -z -E -N -F --base=1000
-w 600 -h 250
DEF:inoctets=/inetpub/wwwroot/rrds/x.x.x.x.rrd:ds0:AVERAGE
DEF:outoctets=/inetpub/wwwroot/rrds/x.x.x.x.rrd:ds1:AVERAGE
TICK:inoctets#ffffa0:1.0:
TICK:outoctets#ffffa0:1.0:
LINE1:inoctets#0000FF:In_traffic CDEF:inbits=inoctets,8,* CDEF:outbits=outoctets,8,*
GPRINT:inbits:LAST:\" Current\: %%5.2lf %%Sbps\"
GPRINT:inbits:MAX:\" Maximum\: %%5.2lf %%Sbps \"
GPRINT:inbits:AVERAGE:\" Average\: %%5.2lf %%Sbps\"
LINE1:outoctets#990000:Out_traffic
GPRINT:outbits:MAX:\"Maximal\: %%5.2lf %%Sbps\"
GPRINT:outbits:AVERAGE:\"Average\: %%5.2lf %%Sbps\"
GPRINT:outbits:LAST:\"Current\: %%5.2lf %%Sbps\"";
exec($command);
return $gif;
}
/////////////////////////////////////////////////////////
////////////////////MAIN PROGRAM/////////////////////////
/////////////////////////////////////////////////////////
error_reporting(E_ALL);
$rrdname="10.1.142.1_1.rrd";
$daygraph="c:\\gifday.png";
$weekgraph="c:\gifweek.png";
$monthgraph="c:\\gifmonth.png";
$yeargraph="c:\\gifyear.png";
/* I don't suggest you to modify listing code below. */
$daystart= "-1d";
$weekstart="-1w";
$monthstart="-1m";
$yearstart="-1y";
$daygraph=gambar($daygraph, $rrdname, $daystart);
echo "<p align='center'><font face='verdana' size='2'><b>Daily graph</b></font>";
echo "<center><img src=images/$daygraph></center><p>";
$weekgraph=gambar($weekgraph, $rrdname, $weekstart);
echo "<p align='center'><font face='verdana' size='2'><b>Weekly graph</b></font>";
echo "<center><img src=images/$weekgraph></center><p>";
$monthgraph=gambar($monthgraph, $rrdname, $monthstart);
echo "<p align='center'><font face='verdana' size='2'><b>Monthly graph</b></font>";
echo "<center><img src=images/$monthgraph></center><p>";
$yeargraph=gambar($yeargraph,$rrdname,$yearstart);
echo "<p align='center'><font face='verdana' size='2'><b>Yearly graph</b></font>";
echo "<center><img src=images/$yeargraph></center><p>";
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20070131/24e15f5d/attachment.htm
More information about the rrd-users
mailing list