[mrtg] RRDTOOL error

Gayan S. Amarasiri gayan.amarasiri at dialog.lk
Tue Dec 30 05:59:59 CET 2008



I am using the following script to draw a graph using rrdtool. But it is
not displaying any value. When I check with "rrdtool fetch" command it
displayed as "nan". Please help on this.



use lib qw(/lib/perl/5.8.0/i386-linux-thread-multi/);

use RRDs;

#$dt= print localtime();

$ipadd="" ;

sub trim($)


 my $string = shift;

 $string =~ s/^\s+//;

 $string =~ s/\s+$//;

 return $string;



sub gettrap{

$getval= join (" ", "snmpget -v2c -c admin" ,$ipadd,$_[0],"|");

open (SNMPGET,"$getval");



return split (/:/ , $val);



sub castStrInt {

            my $t;

      foreach my $d (split(//, shift())) {

      $t = $t * 10 + $d;


      return $t;



@in =gettrap("");

@out= gettrap("");





#system("rrdtool update /var/www/html/testrrd/myrouter.rrd

#system("rrdtool update /var/www/html/testrrd/myrouter1.rrd

RRDs::update ("myrouter.rrd", "N:$intin:$intout");

RRDs::graph ("myrouter-day.png","--start=-86400",
"DEF:outoctets=myrouter.rrd:output:AVERAGE", "AREA:inoctets#FF00ff:In
traffic", "LINE1:outoctets#FF00FF:Out traffic");


Thanks & BR,

Gayan Amarasiri




This e-mail is confidential. It may also be legally privileged. If you are not the intended recipient or have received it in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Any unauthorized reading, reproducing, printing or further dissemination of this e-mail or its contents is strictly prohibited and may be unlawful. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20081230/09507936/attachment.html 

More information about the mrtg mailing list