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....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |