On Fri, Aug 26, 2005 at 07:45:38PM +0200, Tobias Oetiker wrote: Hi Tobias. > > But this doesn't work with the errors generated by the COMMENT statement :/ > > it would be interesting to see a script proofing that since the > code for parsing strings is the same in COMMENT and AREA, which in > turn is the reason for COMMENT being picky about : in the first > place which it was not in 1.0.x O.K. this is the function:
[... snipp ...] sub graph_load_linux() { my $host=shift; my $i=0; my $RealImgWidth=0; my $RealImgHeight=0; my @avg=("5 min","30 min","2 hour","1 day"); for ($i=0;$i<@Times;$i++) { my $Time=$Times[$i]; (undef,$RealImgWidth,$RealImgHeight)=RRDs::graph($ImageDir."/".$host."-load-".$Time.".png","--imgformat","PNG","--start","-1$Time","--lower","0", "--width",$ImgWidth,"--height",$ImgHeight, "DEF:load1=$DataDir"."/".$host."/load.rrd:load1:AVERAGE","DEF:load5=".$DataDir."/".$host."/load.rrd:load5:AVERAGE", "DEF:load15=$DataDir"."/".$host."/load.rrd:load15:AVERAGE", "DEF:usercpu=$DataDir"."/".$host."/cpu.rrd:user:AVERAGE", "DEF:systemcpu=$DataDir"."/".$host."/cpu.rrd:system:AVERAGE","DEF:nicecpu=$DataDir"."/".$host."/cpu.rrd:nice:AVERAGE", "DEF:idlecpu=$DataDir"."/".$host."/cpu.rrd:idle:AVERAGE","CDEF:up=systemcpu,usercpu,nicecpu,+,+", "CDEF:lw=up,idlecpu,+","CDEF:cpu=up,lw,/,100,*","CDEF:cpu10=cpu,10,LE,load15,UNKN,IF", "CDEF:cpu20=cpu,10,GT,cpu,20,LE,*,load15,UNKN,IF", "CDEF:cpu30=cpu,20,GT,cpu,30,LE,*,load15,UNKN,IF","CDEF:cpu40=cpu,30,GT,cpu,40,LE,*,load15,UNKN,IF", "CDEF:cpu50=cpu,40,GT,cpu,50,LE,*,load15,UNKN,IF","CDEF:cpu60=cpu,50,GT,cpu,60,LE,*,load15,UNKN,IF", "CDEF:cpu70=cpu,60,GT,cpu,70,LE,*,load15,UNKN,IF","CDEF:cpu80=cpu,70,GT,cpu,80,LE,*,load15,UNKN,IF", "CDEF:cpu90=cpu,80,GT,cpu,90,LE,*,load15,UNKN,IF","CDEF:cpu100=cpu,90,GT,cpu,100,LE,*,load15,UNKN,IF", "COMMENT:CPU Utilization (%)\\n", "AREA:cpu10#0043ff: 0%-10%","AREA:cpu20#01b2f6:10%-20%","AREA:cpu30#02fcf2:20%-30%","AREA:cpu40#04ff01:30%-40%", "AREA:cpu50#cbfe22:40%-50%", "COMMENT: Minimum","GPRINT:cpu:MIN:%3.2lf%%","COMMENT:Maximum\: ","GPRINT:cpu:MAX:%3.2lf%%\\n", "AREA:cpu60#f6fd2a:50%-60%","AREA:cpu70#f7e526:60%-70%","AREA:cpu80#f9a71b:70%-80%", "AREA:cpu90#fb7113:80%-90%","AREA:cpu100#fe2406:90%-100%", "COMMENT:Average\\: ","GPRINT:cpu:AVERAGE:%3.2lf%%\\n", "COMMENT:\\n", "COMMENT:Load average\\n", "LINE1:load1#af06bf:1 minute ", "COMMENT: Minimum: ", "GPRINT:load1:MIN:%3.2lf","COMMENT:Maximum: ","GPRINT:load1:MAX:%3.2lf\\n", "LINE1:load5#ef0cd1:5 minutes ","COMMENT: Average: ", "GPRINT:load1:AVERAGE:%3.2lf\\n", "LINE1:load15#000000:15 minutes\\n", "HRULE:0#000000"); if (RRDs::error) { printf("<b><u>Error:</u>%s</b>\n",RRDs::error); } else { printf("<center><b><i>Load average on %s - last %s (%s average)</i></b></center><br>",$host,$Time,$avg[$i]); printf("<img src=\"%s\" width=\"%u\" height=\"%u\" alt=\"Load average on %s over last %s - %s average\">\n",$WWWImageDir."/".$host."-load-".$Time.".png",$RealImgWidth,$RealImgHeight,$host,$Time,$avg[$i]); } printf("<hr>\n"); } } [... snipp ...] $DataDir is /home/www/systems Running this (perl) script (as CGI) produces: Error:Garbage ': ' after command: COMMENT:Maximum: Well, I could live without colons ;) Hope that helps ... Andreas. -- Dipl.-Ing. Andreas Maus science+computing ag System Administration Hagellocher Weg 71-75 mail: [EMAIL PROTECTED] 72070 Tuebingen, Germany tel.: +49 7071 9457 456 www.science-computing.de -- Binary/unsupported file stripped by Ecartis -- -- Err : No filename to use for decode, file stripped. -- Type: application/pgp-signature -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://lists.ee.ethz.ch/rrd-users WebAdmin http://lists.ee.ethz.ch/lsg2.cgi