[rrd-users] rrdtool perl interface from 1.0 to 1.2

This is a discussion on [rrd-users] rrdtool perl interface from 1.0 to 1.2 within the RRD Users forums, part of the Networking and Network Related category; Hello, I am trying to migrate some rrdtool scripts from a smokeping based on rrdtool 1.0 to rrdtool 1....


Go Back   Usenet Forums > Networking and Network Related > RRD Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-26-2007
Xavier Beaudouin
 
Posts: n/a
Default [rrd-users] rrdtool perl interface from 1.0 to 1.2

Hello,

I am trying to migrate some rrdtool scripts from a smokeping based on
rrdtool 1.0 to rrdtool 1.2 based.

Migration are ok but it seems that RRDs perl library (and maybe rrdtool
itself also) has some woes with last update data.

I used theses scripts to check some data from Smokeping and send alert in
Nagios is there is more than x% losts packets.

Sample idea :

rrdtool last <rrdfile>
rrdtool fetch <rrdfile> AVERAGE -s <value from last>

This was working... on 1.0.49 without any pain.

Now on 1.2.19 (backport from debian SID to Etch) the script doesn't work
at all and it seems that rrdtool last gave some random values because when
I do rrdtool fetch ... I allways got nan value in return.

I have saw that is rrdtools lastupdate, but it is not yet implemented into
RRDs perl library.

Any hints ? idea ? Fixes ?

Script used :

---//---
#!/usr/bin/perl -w
use RRDs;
use strict;

$ENV{'PATH'} = "/bin:/usr/bin";
$ENV{'ENV'} = "";

if (scalar @ARGV != 3) {
print STDERR join "' '", @ARGV, "\n";
print "not enough argument\n";
exit;
}

my $rrd = $ARGV[0] if (-r $ARGV[0]);
my $warn= $ARGV[1];
my $crit=$ARGV[2];
my ($last) = RRDs::last ($rrd);

my ($start,$step,$names,$data) = RRDs::fetch ($rrd,"AVERAGE","-s",$last);
my $line= @$data[0];
my $nbloss=@$line[1]

if($nbloss >= $crit)
{
printf "RRD CRITICAL too much packet loss or failed to connect.Lost pack
et : %4.2f packets\n", $nbloss;
exit 2;
}
else
{

if( $nbloss >= $warn )
{
printf "RRD WARNING.Lost packet : %4.2f packets\n",
$nbloss;
exit 1;
}
else
{
printf "RRD OK.Lost packet :%4.2f packet\n", $nbloss;
exit 0;
}
}
---//----

See that it is quite simple...


Thanks,
/Xavier

--
Xavier Beaudouin - http://oav.net/

_______________________________________________
rrd-users mailing list
rrd-users@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0