[rrd-users] Re: rdtool/mrtg/14all question

Keith McCallion keith at mccallion.com
Wed Sep 20 22:18:42 MEST 2000


On Wed, 20 Sep 2000, Daniel R . Kilbourne wrote:

> Date: Wed, 20 Sep 2000 10:23:40 -0400
> From: Daniel R . Kilbourne <drk at netophilia.net>
> To: rrd-users at list.ee.ethz.ch
> Subject: [rrd-users] rdtool/mrtg/14all question

Eek. Your message is incredibly hard to read with you not using margins in
your email program. You might want to fix that. The answer to your
question is in the tutorial, but I thought I would share a piece of perl
that I use to accomplish the same thing. I could not get rrdfetch to work
correctly for me, so instead I used rrdgraph and PRINT statements to print
out the data I am interested in. This is just part of the script, I have
another section that reads the configuration file (and populates @target),
and something that generates the reports from this data.

#
# Time to get the data...
#
foreach $dev (@target) {
  @args = ();
  if ($directory =~ /\/$/) {
    $devpath = "$directory$dev.rrd";
  } else {
    $devpath = "$directory/$dev.rrd";
  }

  push @args, "/tmp/$dev-out", "-s", "-86400";
  push @args, "DEF:min=$devpath:ds0:MAX", "DEF:mout=$devpath:ds1:MAX";
  push @args, "PRINT:min:MAX:in %8.0lf", "PRINT:mout:MAX:out %8.0lf";

  my ($graphret, $xs, $ys) = RRDs::graph(@args);

  if ($ERROR = RRDs::error) {
    print STDERR "$dev: $ERROR\n";
  } else {

    foreach $ret (@$graphret) {
      if ($ret =~ /^in (.*)$/) {
        $in{$dev} = $1;
      } elsif ($ret =~ /^out (.*)$/) {
        $out{$dev} = $1;
      }
    }

  }

}

Let me know if you have any questions,

-Keith

--
Keith McCallion
keith at mccallion.com


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list