[rrd-users] Re: Question about multiple DS's in a RRD

Fruitman, Corey Corey.Fruitman at allstream.com
Mon Mar 22 22:01:14 MET 2004


You should be able to make a single call to the update function with all of the values for one timestamp (you don't have to use the --template as long as you specify the entries in order).  It's complaining is because when you do one update per entry, RRDTool assigns NaN to the DS's that you don't specify.

Try this:
RRDs::update("$rrd", "$time:$min15:$cpuload:$vmem");

Corey.


-----Original Message-----
From: rrd-users-bounce at list.ee.ethz.ch
[mailto:rrd-users-bounce at list.ee.ethz.ch]On Behalf Of
Christian_Lair at i2.com
Sent: March 22, 2004 3:50 PM
To: rrd-users at list.ee.ethz.ch
Subject: [rrd-users] Question about multiple DS's in a RRD


I'm trying to create a rrd that will keep track of some stats for unix 
machines. I'm tracking load avg, cpu load, and vm load, the data is being 
collected via SNMP and stored in a colon separated file, updated every 15 
mins. The whole purpose of putting the data into a RRD is to create 1 
graph showing all 3 items. I've created a RRD using this command:
rrdtool create /data/load_avg.rrd --start 1072936800 \
 --step 900 \
 DS:load:GAUGE:900:0.0:U \
 DS:cpu:GAUGE:900:0:100 \ 
 DS:vm:GAUGE:900:0:U \
 RRA:AVERAGE:0.5:1:8640

I'm using Perl to parse the datafile and update the RRD. I started out 
just updating the load avg and that worked just fine. I've now decided to 
take another step forward and update the cpu and vm using this code:

open (DATA,"/data/rrd/datafile");

while (<DATA>) {
  my 
($time,$min,$seconds,$hostname,$ip,$cpu,$cpuload,$usertime,$systime,$iowait,$vmem,$uptime,$load,$
mem,$os,$cpuspeed,$fs,$version) = split (/:/);

  my $date = join (':',$time,$min,$seconds);
  $time = &UnixDate($date,"%s");

  my($min1,$min10,$min15)= split (/,/,$load);

  RRDs::update ("$rrd", "--template", "load", "$time:$min15");
  my $ERR=RRDs::error;
  die "ERROR while updating rrd: $ERR\n" if $ERR;

RRDs::update ("$rrd", "--template", "cpu", "$time:$cpuload");
  my $ERR=RRDs::error;
  die "ERROR while updating rrd: $ERR\n" if $ERR;

RRDs::update ("$rrd", "--template", "vm", "$time:$vmem");
  my $ERR=RRDs::error;
  die "ERROR while updating rrd: $ERR\n" if $ERR;
}
close DATA;

Now I'm getting the error: ERROR while updating rrd: illegal attempt to 
update using time 1072937826 when last update time is 1072937826 (minimum 
one second step).

I assume its because of the second and third RRDs::update statements. How 
can I update all three DS's in the RRD when they have the same update 
time?


Thanks,
Christian Lair



--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list