[rrd-users] can't update rrd, value all 0Hello all
Leo Le
lle at socccd.cc.ca.us
Thu Feb 3 23:29:03 MET 2000
Hello all,
I am desperate. Somebody please look at my simple code and show me
what's wrong. I knew the first run has problem with the if statement,
but the problem is that:
1. the test.rrd file created OK.
2. the snmpget printed out $DS1, $DS2 value OK
3. rrdtool fetch and rrdtool dump show all value 0.
I tried step 300 -> 100, same thing.
Thanks for your help.
Leo
#---------------------------#!/usr/local/bin/perl
use lib qw(c:\\rrd107\\arch\\auto\\RRDs c:\\rrd107\\lib
c:\\mrtg288\\run);
use strict;
use CGI qw(:standard);
use SNMP_util;
use RRDs;
my $now=time;
my $DS1=0;
my $DS2=0;
my $RRD1="c:\\mrtg288\\run\\test.rrd";
#my $RRD1="1010100251-2-out.rrd";
my $ERROR=RRDs::error();
#
my @options1=("DS:unicast:COUNTER:600:U:U",
"DS:nonunicast:COUNTER:600:U:U");
my @options2=("RRA:AVERAGE:0.5:1:24");
#my @options2=("RRA:AVERAGE:0.5:1:600", "RRA:AVERAGE:0.5:6:600",
"RRA:AVERAGE:0.5:24:600", "RRA:AVERAGE:0.5:288:732");
#my @options3=("RRA:MAX:0.5:1:600", "RRA:MAX:0.5:6:600",
"RRA:MAX:0.5:24:600", "RRA:MAX:0.5:288:732");
#----- create rrds--------------------------
if (! -e $RRD1) {
$now=($now/300)*300;
RRDs::create $RRD1, "-b", $now, "-s", "300", @options1, @options2;#
@options3;
if($ERROR=RRDs::error()){
die "$0:unable to create '$RRD1': $ERROR\n";
}
}
#----update-------
my @args=("N:$DS1:$DS2");
($DS1,$DS2)=&snmpget("public\@10.10.100.251","1.3.6.1.2.1.2.2.1.17.7","1.3.6.1.2.1.2.2.1.18.7");
#print time;
print "$DS1, $DS2\n";
RRDs::update $RRD1, @args;
if($ERROR=RRDs::error()){
die "$0:unable to update '$RRD1': $ERROR\n";
}
#----------------------------------
<!-- Round Robin Database Dump -->
<rrd>
<version> 0001 </version>
<step> 300 </step> <!-- Seconds -->
<lastupdate> 949607254 </lastupdate> <!-- 2000-02-03 11:47:34 Pacific
Standard Time -->
<ds>
<name> unicast </name>
<type> COUNTER </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> NaN </min>
<max> NaN </max>
<!-- PDP Status -->
<last_ds> unicast </last_ds>
<value> 0.0000000000e+000 </value>
<unknown_sec> 0 </unknown_sec>
</ds>
<ds>
<name> nonunicast </name>
<type> COUNTER </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> NaN </min>
<max> NaN </max>
<!-- PDP Status -->
<last_ds> nonunicast </last_ds>
<value> 0.0000000000e+000 </value>
<unknown_sec> 0 </unknown_sec>
</ds>
<!-- Round Robin Archives -->
<rra>
<cf> AVERAGE </cf>
<pdp_per_row> 1 </pdp_per_row> <!-- 300 seconds -->
<cdp_prep>
<ds><value> NaN </value> <unknown_datapoints> 0
</unknown_datapoints></ds>
<ds><value> NaN </value> <unknown_datapoints> 0
</unknown_datapoints></ds>
</cdp_prep>
<database>
<!-- 2000-02-03 09:50:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 09:55:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:00:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:05:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:10:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:15:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:20:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:25:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:30:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:35:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:40:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:45:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:50:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 10:55:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:00:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:05:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:10:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:15:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:20:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:25:00 Pacific Standard Time --> <row><v> NaN
</v><v> NaN </v></row>
<!-- 2000-02-03 11:30:00 Pacific Standard Time --> <row><v>
0.0000000000e+000 </v><v> 0.0000000000e+000 </v></row>
<!-- 2000-02-03 11:35:00 Pacific Standard Time --> <row><v>
0.0000000000e+000 </v><v> 0.0000000000e+000 </v></row>
<!-- 2000-02-03 11:40:00 Pacific Standard Time --> <row><v>
0.0000000000e+000 </v><v> 0.0000000000e+000 </v></row>
<!-- 2000-02-03 11:45:00 Pacific Standard Time --> <row><v>
0.0000000000e+000 </v><v> 0.0000000000e+000 </v></row>
</database>
</rra>
</rrd>
#--------------
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
More information about the rrd-users
mailing list