[rrd-users] Re: rrd script assistance

steve rader rader at teak.wiscnet.net
Sat Jan 8 18:14:14 MET 2000


  
 > *>  > *> I'm back to thinking that RRDtool really should allow for
 > *>  > *> 
 > *>  > *>   % rrdtool last --values --ds ifoper:ifadmin
 > *>  > *>   947262300 1.00 1.00

 > *>  > what does this do you can not do with rrdgraph and LAST ?
 
 > *> You can type it quickly at the command line and it's syntax is
 > *> significantly more simple.
 > 
 > From: Tobias Oetiker
 > yes, but from which RRA would the values be pulled ? or would it use the
 > last ds values or the values from the PDP area ?

I'd like to get the latest values from the RRA with the highest
(shortest time) resolution.  So, da!, I guess what I'm after is
just something like:

  rrdtool fetch -s -1sec some.rrd AVERAGE  | tail -2 | head -1

It appears that the last row from the above is for a CDP a bit
in the future (!) so I just whipped up "rrdlastds": 

 bash% ./rrdlastds some.rrd
 Sat Jan  8 11:05:00 2000        12774.39 input         3244.12 output 

I'll be adding "--conversion" and "--scale' so that I can do

 bash% ./rrdlast some.rrd -c 8,* -s 
 Sat Jan  8 11:10:00 2000        73.57 K input         28.52 K output 

Kinda cool, eh.  Maybe it should go in the RRDtool contrib?

(Alex, notice the bits to Kbits conversion via n/1000, please. =;)

later
steve
- - -
systems guy
wiscnet.net

- - - cut here - - - 
#!/usr/bin/perl
#
# rrdlastds - report the latest DS values from the RRA with
# the shortest time resolution
#
# steve rader
# <rader at wiscnet.net>
# Jan 8th, 2000
#

use RRDs;

if ( $#ARGV[0] != 0 ) {
  print "usage: rrdlast some.rrd\n";
  exit 1;
}

@fetch = ( "$ARGV[0]", '-s', '-1sec', 'AVERAGE' );
($start,$step,$names,$data) = RRDs::fetch @fetch;

$start += $step;
print scalar localtime($start);
  
$line = $$data[0];
for $i (0 .. $#$names) {
  printf " %15.2f %s", $$line[$i], $$names[$i];
}
print "\n";

--
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