[rrd-users] Trying to use RRDs to do graphing
David Ball
davidtball at gmail.com
Fri Apr 27 22:33:03 CEST 2007
On the recommendation of others on the list, I'm endeavouring to
translate system() calls to RRDs::bleh invocations in my perl scripts.
I'm stumbling a bit, but am darn close.
Currently, when trying to graph, the method below is returning the
graph's x and y size, as well as the $results from some PRINT
statements (all correctly, as far as I can tell), and it's even
creating the desired .png image, but the image file is 0 bytes. Any
advice would be appreciated.
The commented -x line is one I was hoping to use, but RRDs::graph
complains that it's an invalid format. Also, I've had problems
getting CDEFs involving +,-,*,/ calculations working, but for now,
I'll settle for seeing an actual graph.
Cheers.
# "-x 'DAY:1:DAY:7:DAY:2:86400:%d'",
my ($results, $xsize, $ysize) = RRDs::graph(
"$graph",
"-t '$Customer - $ItemList{'Month'} $reportYear'",
"-s $reportStartSecs",
"-e $reportEndSecs",
"-w 600",
"-h 400",
"-v bps",
"DEF:inbps=$Policed_in_RRD:bps:MAX",
"DEF:outbps=$Policed_out_RRD:bps:MAX",
"VDEF:inbits_tot=inbps,TOTAL",
"VDEF:outbits_tot=outbps,TOTAL",
"CDEF:95percpointer=inbps,outbps,MAX",
"VDEF:perc95=95percpointer,95,PERCENT",
"VDEF:avg_in=inbps,AVERAGE",
"VDEF:avg_out=outbps,AVERAGE",
"VDEF:peak_in=inbps,MAXIMUM",
"VDEF:peak_out=outbps,MAXIMUM",
"HRULE:perc95#000000",
"COMMENT: ",
"LINE1:inbps#00a000:'Inbound '",
"LINE1:outbps#a00000:'Outbound'",
"GPRINT:perc95: 95th Percentile\\: %6.2lf%sbps\\n",
"COMMENT:\' avg\\:\'",
"GPRINT:avg_in:%6.2lf%sbps ",
"GPRINT:avg_out:%6.2lf%sbps",
"COMMENT: Samples Taken\\: $num_samples \\n",
"COMMENT: peak\\:",
"GPRINT:peak_in:%6.2lf%sbps ",
"GPRINT:peak_out:%6.2lf%sbps\\n",
"COMMENT:Total Bytes\\: $inbytes_tot $outbytes_tot\\n",
"COMMENT: Report Generated\\:
$report_generated",
"PRINT:perc95:95th=%6.2lf%sbps"
);
my $ERR=RRDs::error;
&log("RRDs graph errors: $ERR");
More information about the rrd-users
mailing list