How can I use Perl and RRD to plot ping times?

Posted by ChrisMuench on Stack Overflow See other posts from Stack Overflow or by ChrisMuench
Published on 2010-04-21T19:15:05Z Indexed on 2010/04/21 21:13 UTC
Read the original article Hit count: 416

Filed under:
|
|

I'm trying to do my first rrd graph through Perl. I have tried RRD::Simple and rrds and just can't get either one to work.

Here's what I have so far:

 use strict;
 use RRD::Simple ();

 # Create an interface object
 my $rrd = RRD::Simple->new( file => "server.rrd" );

 # Put some arbitary data values in the RRD file for the same
 # 3 data sources called bytesIn, bytesOut and faultsPerSec.
  $rrd->create(
             EqSearch => "DERIVE",
             MfSearch => "DERIVE",
             EQCostBasis => "DERIVE",
             MFCostBasis => "DERIVE"
         );

 $rrd->update(
             EqSearch => 2,
             MfSearch => 3,
             EQCostBasis => 10,
             MFCostBasis => 15
         );

 # Generate graphs:
 # /var/tmp/myfile-daily.png, /var/tmp/myfile-weekly.png
 # /var/tmp/myfile-monthly.png, /var/tmp/myfile-annual.png
 my %rtn = $rrd->graph(
             destination => "/Users/cmuench/Documents/Code/perl",
             title => "Server A",
             vertical_label => "",
             interlaced => "",
             periods => [qw(hour)]
         );

© Stack Overflow or respective owner

Related posts about perl

Related posts about rrdtool