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

Xavier Beaudouin kiwi at oav.net
Mon Nov 26 16:29:15 CET 2007


On Mon, 26 Nov 2007, Joe Loiacono wrote:

> Make sure you have the RRDs that goes with 1.2. I upgraded RRDtool to v
> 1.2, and somehow didn't get the RRDs upgraded.

I am 100% sure. It is a brand new server installed from scratch :)

Old server will be killed when this issue is fixed... (had lots of other 
issues, but this one is the most nasty one)....

/Xavier

> Joe
>
>
>
>
> Xavier Beaudouin <kiwi at oav.net>
> Sent by: rrd-users-bounces at lists.oetiker.ch
> 11/26/2007 08:30 AM
>
> To
> rrd-users at lists.oetiker.ch
> cc
>
> Subject
> [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 at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
>

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



More information about the rrd-users mailing list