<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>[rrd-users] Correct CDEF to get the spam count right?</TITLE>
</HEAD>
<BODY>
<BR>
<P><FONT SIZE=2>Hi,<BR>
<BR>
I'm trying to generate my own graphs using php, but I get
nothing. can anyone shed a light. Here goe the code.
</FONT></P><FONT
color=#ff0000 size=2>
<P><?</FONT><FONT size=2> <BR><BR></FONT><B><FONT color=#0000f0
size=2>function</B></FONT><FONT size=2> gambar<B>($gif,$rrd,$start)</B>
<BR><B>{</B> <BR><BR><BR><B>$path_rrdbase_dir</B> <B>=</B> </FONT><FONT
color=#008000 size=2>"c:\\inetpub\\wwwroot\\rrds"</FONT><B><FONT size=2>;</B>
<BR><BR><B>$command=</B></FONT><FONT color=#008000
size=2>"c:\\rrdtool\\rrdtool.exe graph graphs/test.png -s -6h -a PNG -A -M -L 4
-z -E -N -F --base=1000<BR>-w 600 -h 250
<BR>DEF:inoctets=/inetpub/wwwroot/rrds/x.x.x.x.rrd:ds0:AVERAGE
<BR>DEF:outoctets=/inetpub/wwwroot/rrds/x.x.x.x.rrd:ds1:AVERAGE
<BR>TICK:inoctets#ffffa0:1.0: <BR>TICK:outoctets#ffffa0:1.0:
<BR>LINE1:inoctets#0000FF:In_traffic CDEF:inbits=inoctets,8,*
CDEF:outbits=outoctets,8,* <BR>GPRINT:inbits:LAST:\" Current\: %%5.2lf %%Sbps\"
<BR>GPRINT:inbits:MAX:\" Maximum\: %%5.2lf %%Sbps \"<BR>GPRINT:inbits:AVERAGE:\"
Average\: %%5.2lf
%%Sbps\"<BR>LINE1:outoctets#990000:Out_traffic<BR>GPRINT:outbits:MAX:\"Maximal\:
%%5.2lf %%Sbps\" <BR>GPRINT:outbits:AVERAGE:\"Average\: %%5.2lf %%Sbps\"
<BR>GPRINT:outbits:LAST:\"Current\: %%5.2lf %%Sbps\""</FONT><B><FONT
size=2>;</B> <BR>exec<B>($command);</B><BR><BR></FONT><B><FONT color=#0000f0
size=2>return</B></FONT><FONT size=2> <B>$gif;</B><BR><B>}</B>
<BR><BR></FONT><FONT color=#008000
size=2>/////////////////////////////////////////////////////////<BR>////////////////////MAIN
PROGRAM/////////////////////////<BR>/////////////////////////////////////////////////////////<BR></FONT><FONT
size=2>error_reporting<B>(</B>E_ALL<B>);</B><BR><BR><BR><B>$rrdname=</B></FONT><FONT
color=#008000 size=2>"10.1.142.1_1.rrd"</FONT><B><FONT size=2>;</B>
<BR><B>$daygraph=</B></FONT><FONT color=#008000
size=2>"c:\\gifday.png"</FONT><B><FONT size=2>;</B>
<BR><B>$weekgraph=</B></FONT><FONT color=#008000
size=2>"c:\gifweek.png"</FONT><B><FONT size=2>;</B>
<BR><B>$monthgraph=</B></FONT><FONT color=#008000
size=2>"c:\\gifmonth.png"</FONT><B><FONT size=2>;</B>
<BR><B>$yeargraph=</B></FONT><FONT color=#008000
size=2>"c:\\gifyear.png"</FONT><B><FONT size=2>;</B> <BR><BR></FONT><FONT
color=#008000 size=2>/* I don't suggest you to modify listing code below.
*/</FONT><FONT size=2> <BR><B>$daystart=</B> </FONT><FONT color=#008000
size=2>"-1d"</FONT><B><FONT size=2>;</B> <BR><B>$weekstart=</B></FONT><FONT
color=#008000 size=2>"-1w"</FONT><B><FONT size=2>;</B>
<BR><B>$monthstart=</B></FONT><FONT color=#008000 size=2>"-1m"</FONT><B><FONT
size=2>;</B> <BR><B>$yearstart=</B></FONT><FONT color=#008000
size=2>"-1y"</FONT><B><FONT size=2>;</B>
<BR><BR><B>$daygraph=</B>gambar<B>($daygraph,</B> <B>$rrdname,</B>
<B>$daystart);</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><p align='center'><font face='verdana' size='</FONT><FONT
color=#0000f0 size=2>2</FONT><FONT size=2>'><b></FONT><FONT
color=#008000 size=2>Daily graph</FONT><FONT
size=2></b></font></FONT><FONT color=#008000 size=2>"</FONT><B><FONT
size=2>;</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><center></FONT><FONT color=#800000 size=2><img</FONT><FONT
size=2> </FONT><FONT color=#800000 size=2>src</FONT><FONT size=2>=</FONT><FONT
color=#800000 size=2>images</FONT><FONT size=2>/$</FONT><FONT color=#800000
size=2>daygraph></FONT><FONT size=2></center><p></FONT><FONT
color=#008000 size=2>"</FONT><B><FONT size=2>;</B>
<BR><B>$weekgraph=</B>gambar<B>($weekgraph,</B> <B>$rrdname,</B>
<B>$weekstart);</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><p align='center'><font face='verdana' size='</FONT><FONT
color=#0000f0 size=2>2</FONT><FONT size=2>'><b></FONT><FONT
color=#008000 size=2>Weekly graph</FONT><FONT
size=2></b></font></FONT><FONT color=#008000 size=2>"</FONT><B><FONT
size=2>;</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><center></FONT><FONT color=#800000 size=2><img</FONT><FONT
size=2> </FONT><FONT color=#800000 size=2>src</FONT><FONT size=2>=</FONT><FONT
color=#800000 size=2>images</FONT><FONT size=2>/$</FONT><FONT color=#800000
size=2>weekgraph></FONT><FONT size=2></center><p></FONT><FONT
color=#008000 size=2>"</FONT><B><FONT size=2>;</B>
<BR><B>$monthgraph=</B>gambar<B>($monthgraph,</B> <B>$rrdname,</B>
<B>$monthstart);</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><p align='center'><font face='verdana' size='</FONT><FONT
color=#0000f0 size=2>2</FONT><FONT size=2>'><b></FONT><FONT
color=#008000 size=2>Monthly graph</FONT><FONT
size=2></b></font></FONT><FONT color=#008000 size=2>"</FONT><B><FONT
size=2>;</B> <BR>echo </FONT><FONT color=#008000 size=2>"</FONT><FONT
size=2><center></FONT><FONT color=#800000 size=2><img</FONT><FONT
size=2> </FONT><FONT color=#800000 size=2>src</FONT><FONT size=2>=</FONT><FONT
color=#800000 size=2>images</FONT><FONT size=2>/$</FONT><FONT color=#800000
size=2>monthgraph></FONT><FONT size=2></center><p></FONT><FONT
color=#008000 size=2>"</FONT><B><FONT size=2>;</B>
<BR><B>$yeargraph=</B>gambar<B>($yeargraph,$rrdname,$yearstart);</B> <BR>echo
</FONT><FONT color=#008000 size=2>"</FONT><FONT size=2><p
align='center'><font face='verdana' size='</FONT><FONT color=#0000f0
size=2>2</FONT><FONT size=2>'><b></FONT><FONT color=#008000
size=2>Yearly graph</FONT><FONT size=2></b></font></FONT><FONT
color=#008000 size=2>"</FONT><B><FONT size=2>;</B> <BR>echo </FONT><FONT
color=#008000 size=2>"</FONT><FONT size=2><center></FONT><FONT
color=#800000 size=2><img</FONT><FONT size=2> </FONT><FONT color=#800000
size=2>src</FONT><FONT size=2>=</FONT><FONT color=#800000
size=2>images</FONT><FONT size=2>/$</FONT><FONT color=#800000
size=2>yeargraph></FONT><FONT size=2></center><p></FONT><FONT
color=#008000 size=2>"</FONT><B><FONT size=2>;</B>
<BR><BR><BR><B>?</B>></P></FONT>
</BODY>
</HTML>