0

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)]
        );

The output is:

graph http://www.mediafire.com/imgbnc.php/a39e2bd662adefa823dca66351db637c5g.jpg

Ether
  • 53,118
  • 13
  • 86
  • 159
Chris Muench
  • 17,444
  • 70
  • 209
  • 362

1 Answers1

0

From your above script, the main issue is that you don't have enough data to show in graphs. you can see the data in your rrd using 'rrdtool fetch`.

If you can use bash instead of perl. Look at this "Round Trip and Packet Loss stats with rrdtool"

If you still want to use perl module RRD::Simple, please look at the examples provided with this module i.e. RRD::Simple::Examples Or provide more details about the problem you are facing.

Space
  • 7,049
  • 6
  • 49
  • 68
  • Unfortunately I really need to use perl as I have other parts of my script written in perl. nobody else? – Chris Muench Apr 22 '10 at 16:05
  • What are the other parts and what the problem/errors you are facing. – Space Apr 23 '10 at 04:37
  • Well basically I generate the graph but no data is showing up inside them. – Chris Muench Apr 23 '10 at 17:46
  • at what frequency you are updating the rrd and how you are getting the ing response. I cant see all this in provided code. I woud like to suggest you to have a look at the bash example i provided and the rrd simple examples. Also look at the RRDTool documentations for data. – Space Apr 23 '10 at 18:00