[rrd-users] Problem with CDEFs, and question about PRINT

David Ball davidtball at gmail.com
Mon Apr 23 19:27:22 CEST 2007


  Hi there.  Using a Perl script, I'm creating an RRD that spans
exactly 1 month, with a 300s step, and it's graphing bandwidth
utilisation in BITS per second.  I'm calculating inbps and outbps
using something resembling:

DEF:inbps=rrdfile.rrd:bps:MAX

   In trying to calculate total Bytes for the month, I'm able to
calculate total bits 'in' and total bits 'out', but the graphing fails
when I try to use a CDEF to add the 2 values together and/or try to
divide by 8 to get Bytes.  From the Perl script I'm using a system()
call to call rrdtool.  The current system() call line I'm using can be
found below...the ugliness of which can be attributed to the fact that
I'm still toying with formatting, etc.

  Second question is about PRINT when generating a graph.  Since I'm
calling 'rrdtool graph' via a system() call in perl, how might I go
about capturing the PRINT'd data to a variable/array, which I could
then print out in an HTML table prior to printing the graph image.
   Thanks in advance.

david



system($RRDTool . "graph $graph -t \"$Customer - $ItemList{'Month'}
$reportYear\" -s $reportStartSecs -e $reportEndSecs $grtype -w 600 -h
400
 -v bps -x DAY:1:DAY:7:DAY:2:86400:%d 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:totbytes=inbits,outbits,\+,8,\*     <--- fails when I try
variations of this
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\\:'
COMMENT:'                                   Report Generated\\:
$report_generated'");



More information about the rrd-users mailing list