<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">Joe<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Xavier Beaudouin <kiwi@oav.net></b>
</font>
<br><font size=1 face="sans-serif">Sent by: rrd-users-bounces@lists.oetiker.ch</font>
<p><font size=1 face="sans-serif">11/26/2007 08:30 AM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">rrd-users@lists.oetiker.ch</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[rrd-users] rrdtool perl interface from
1.0 to 1.2</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hello,<br>
<br>
I am trying to migrate some rrdtool scripts from a smokeping based on <br>
rrdtool 1.0 to rrdtool 1.2 based.<br>
<br>
Migration are ok but it seems that RRDs perl library (and maybe rrdtool
<br>
itself also) has some woes with last update data.<br>
<br>
I used theses scripts to check some data from Smokeping and send alert
in <br>
Nagios is there is more than x% losts packets.<br>
<br>
Sample idea :<br>
<br>
rrdtool last <rrdfile><br>
rrdtool fetch <rrdfile> AVERAGE -s <value from last><br>
<br>
This was working... on 1.0.49 without any pain.<br>
<br>
Now on 1.2.19 (backport from debian SID to Etch) the script doesn't work
<br>
at all and it seems that rrdtool last gave some random values because when
<br>
I do rrdtool fetch ... I allways got nan value in return.<br>
<br>
I have saw that is rrdtools lastupdate, but it is not yet implemented into
<br>
RRDs perl library.<br>
<br>
Any hints ? idea ? Fixes ?<br>
<br>
Script used :<br>
<br>
---//---<br>
#!/usr/bin/perl -w<br>
use RRDs;<br>
use strict;<br>
<br>
$ENV{'PATH'} = "/bin:/usr/bin";<br>
$ENV{'ENV'} = "";<br>
<br>
if (scalar @ARGV != 3) {<br>
print STDERR join "' '", @ARGV,
"\n";<br>
print "not enough argument\n";<br>
exit;<br>
}<br>
<br>
my $rrd = $ARGV[0] if (-r $ARGV[0]);<br>
my $warn= $ARGV[1];<br>
my $crit=$ARGV[2];<br>
my ($last) = RRDs::last ($rrd);<br>
<br>
my ($start,$step,$names,$data) = RRDs::fetch ($rrd,"AVERAGE","-s",$last);<br>
my $line= @$data[0];<br>
my $nbloss=@$line[1]<br>
<br>
if($nbloss >= $crit)<br>
{<br>
printf "RRD CRITICAL too much packet loss or failed to connect.Lost
pack<br>
et : %4.2f packets\n", $nbloss;<br>
exit 2;<br>
}<br>
else<br>
{<br>
<br>
if( $nbloss >= $warn )<br>
{<br>
printf "RRD
WARNING.Lost packet : %4.2f packets\n", <br>
$nbloss;<br>
exit 1;<br>
}<br>
else<br>
{<br>
printf "RRD
OK.Lost packet :%4.2f packet\n", $nbloss;<br>
exit 0;<br>
}<br>
}<br>
---//----<br>
<br>
See that it is quite simple...<br>
<br>
<br>
Thanks,<br>
/Xavier<br>
<br>
--<br>
Xavier Beaudouin - http://oav.net/<br>
<br>
_______________________________________________<br>
rrd-users mailing list<br>
rrd-users@lists.oetiker.ch<br>
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users<br>
</tt></font>
<br>