custom rrd data

Ivan Verbeeck ivan.verbeeck at vmma.be
Tue Apr 26 15:21:14 CEST 2005


Hello,

Question about the custom rrd data :

I configured the hobbit server (4.0.2 installed from the .deb release on
a debian linux) for generating a custom rrd.
- wrote a simple script (tested with perl and shell script)
- added the --extra-script and the --extra-test in the launch file
- added the name of the test in the config file
- added a section in hobbitgraph.cfg
- restarted hobbit

The web page directly shows a link to an rrd, but the rrd file isn't
created. After a few hours(!) the rrd is generated and then sometimes
(random once every few hours/days) data is inserted.
The script runs every time when data is received (5 minutes), get the
correct data and print the correct output.
I now changed the script to update the rrd itselfs(see bottom of the
mail), but that isn't offcourse the right solution.
Anyone an idee what can be wrong?

Kind regards,
Ivan Verbeeck


#!/usr/bin/perl
use RRDs;
#
# Input parameters: hostname, testname, and filename (messagefile)
#

$hostname = $ARGV[0];
$testname = $ARGV[1];
$filename = $ARGV[2];

#
# check and process "usercount"
#

if ($testname eq "usercount") {
  open(DATA, $filename) || die("Could not open messagefile!");
  while ($line = <DATA>) {
    if ($line =~ /gebruikers/) {
      @words = split(/:/, $line);
      $aantal = substr($words[1],1,2);
    }
  }
  close (DATA);

#
# update the rrd instead of printing to hobbit :-(
#

#  print "DS:users:GAUGE:600:0:U\n";
#  print "usercount.rrd\n";
#  print $aantal,"\n";

  $rrd = $ENV{"BBRRDS"}."/$hostname/$testname.rrd";
  if (! -e $rrd) {
    my $interval = 5;
    my $time = time;
    my @args = ($rrd, '-b', $time-10, '-s', int($interval * 60),
                "DS:users:GAUGE:600:U:U",
                "RRA:AVERAGE:0.5:1:576",
                "RRA:AVERAGE:0.5:6:576",
                "RRA:AVERAGE:0.5:24:576",
                "RRA:AVERAGE:0.5:288:576");
    RRDs::create(@args); my $e = RRDs::error(); die "ERROR: Cannot
create logfile: $e\n" if $e;
  }
  RRDs::update ($rrd,"N:$aantal"); my $e = RRDs::error(); die "ERROR
while updating rrd: $e\n" if $e;

# end of update rrd
}
exit;



More information about the Xymon mailing list