[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.

#  "-x 'DAY:1:DAY:7:DAY:2:86400:%d'",
my ($results, $xsize, $ysize) = RRDs::graph(
    "-t '$Customer - $ItemList{'Month'} $reportYear'",
    "-s $reportStartSecs",
    "-e $reportEndSecs",
    "-w 600",
    "-h 400",
    "-v bps",
    "COMMENT:             ",
    "LINE1:inbps#00a000:'Inbound  '",
    "GPRINT:perc95:                          95th Percentile\\: %6.2lf%sbps\\n",
    "COMMENT:\'        avg\\:\'",
    "GPRINT:avg_in:%6.2lf%sbps  ",
    "COMMENT:                            Samples Taken\\:  $num_samples \\n",
    "COMMENT:       peak\\:",
    "GPRINT:peak_in:%6.2lf%sbps  ",
    "COMMENT:Total Bytes\\: $inbytes_tot     $outbytes_tot\\n",
    "COMMENT:                                   Report Generated\\:
my $ERR=RRDs::error;
&log("RRDs graph errors: $ERR");

More information about the rrd-users mailing list