<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 &lt;kiwi@oav.net&gt;</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 &lt;rrdfile&gt;<br>
rrdtool fetch &lt;rrdfile&gt; AVERAGE -s &lt;value from last&gt;<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'} = &quot;/bin:/usr/bin&quot;;<br>
$ENV{'ENV'} = &quot;&quot;;<br>
<br>
if (scalar @ARGV != 3) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; print STDERR join &quot;' '&quot;, @ARGV,
&quot;\n&quot;;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; print &quot;not enough argument\n&quot;;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; 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,&quot;AVERAGE&quot;,&quot;-s&quot;,$last);<br>
my $line= @$data[0];<br>
my $nbloss=@$line[1]<br>
<br>
if($nbloss &gt;= $crit)<br>
{<br>
 &nbsp;printf &quot;RRD CRITICAL too much packet loss or failed to connect.Lost
pack<br>
et : %4.2f packets\n&quot;, $nbloss;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; exit 2;<br>
}<br>
else<br>
{<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; if( $nbloss &gt;= $warn )<br>
 &nbsp; &nbsp; &nbsp; &nbsp; {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf &quot;RRD
WARNING.Lost packet : %4.2f packets\n&quot;, <br>
$nbloss;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 1;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; }<br>
 &nbsp; &nbsp; &nbsp; &nbsp; else<br>
 &nbsp; &nbsp; &nbsp; &nbsp; {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf &quot;RRD
OK.Lost packet :%4.2f packet\n&quot;, $nbloss;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 0;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; }<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>