[rrd-users] Re: Hov the get max and average values for an interva l
Philippe.Simonet at swisscom.com
Philippe.Simonet at swisscom.com
Fri Jun 9 15:01:05 MEST 2000
i've written a rrdstats, which can be included in rrdtool, who is doing that
and some other things. I is included in the NT distribution. THe C is
standard, so you should be able to include it in an UNIX machine :-)
Philippe
README for stats module for rrd
-------------------------------
1 : how to build
(if you use the NT binary distribution, all is included)
- add rrd_statsl.c to the rrd library built
- compile the rrd_stats.c
- link rrd_stats with rrd library, and you have a command-line
rrd_stats
- replace the perl-shared rrds.xs, and rebuild the rest
2 : examples
there are some examples in perl-shared/t, some of them requires the
CHART module
3 : documentation
usage: (4 function are implemented, perl-type call is
described)
----------------------------------------------------------------
mean/max/min: computes the average / minimum / maxmimum /
integration value for a rrd database, for each ds
my ($step, $start, $end, $res, $names) =
RRDs::stats $rrd,
"func:pstep:cf","--start=stime","--end=etime";
parameters:
func : mean/max/min/int
pstep : proposed step (function funds the best based on
time-range and rra/step availability)
cf : consolidation function
stime-etime : measure time
results:
$step : the step that was found and choosen
$start, $end : the really start and end
$res : list of result
$names : list of corresponding ds names
examples:
my ($step, $start, $end, $avg, $names) = RRDs::stats $rrd,
"mean:300:AVERAGE","--start=-1m";
my ($step, $start, $end, $avg, $names) = RRDs::stats $rrd,
"min:300:AVERAGE","--start=-1d";
my ($step, $start, $end, $avg, $names) = RRDs::stats $rrd,
"max:300:AVERAGE","--start=-1w";
my ($step, $start, $end, $avg, $names) = RRDs::stats $rrd,
"int:300:AVERAGE","--start=-1w";
----------------------------------------------------------------
dist: computes the distribution of values for a given ds in
an rrd
my ($step, $start, $end, $before, $after, $res) =
RRDs::stats $rrd,
"dist:minval:maxval:ds:nbdist:pstep:cf","--start=stime","--end=$etime";
parameters:
pstep : proposed step (function funds the best based on
time-range and rra/step availability)
ds : name of ds
nbdist : number of interval to compute dist (between minval
and maxval)
cf : consolidation function
stime-etime : measure time
maxval, minval : minimum and maximum value to compute the
distribution
results:
$step : the step that was found and choosen
$start, $end : the really start and end
$res : list of results
$before, $after : results that are <minval(before) of >
maxval(after)
example:
my ($step, $sta, $en, $before, $after, $res) = RRDs::stats
$rrd, "dist:0:100:ds1:10:300:AVERAGE","--start=-1d";
----------------------------------------------------------------
rrd_stats choose the rra with the following rules : (not
same as fetch or graph)
- for each rra it computes an overlap factor that is the
factor between the requested
range (end-start) and the available range of this rra
- for overlap factor that are not 'very' different (90%), it
take the step that is
closest from the proposed step );
4.3.2000, philippe.simonet at swisscom.com
-----Original Message-----
From: Bjorn Nordbo [mailto:bn at nextra.com]
Sent: vendredi, 9. juin 2000 14:45
To: rrd-users at list.ee.ethz.ch
Subject: [rrd-users] Hov the get max and average values for an interval
I am working on a utility similiar to 14all.cgi) that aims to imitate
the way MRTG presents information. The idea is to have different modes
to return the various dynamic information like last updated, last, max
average-text and the graph itself.
Anyway, I can't figure out how to to get the max and average values
from the RRD. Conceptually, I would like 'rrdtool fetch' to do this:
$ rrdtool fetch dings.rrd AVERAGE --start -1d
105613 5331357
$
Where the numbers returned are the average values for the two data-
sources of dings.rrd (is the order of these fixed?) for the last
24 hours.
I'm well aware the this is not the way 'rrdtool fetch' works, but
this is the kind of functionality I'm looking for.
Is this possible to do with rrdtool? I would really like to avoid
fetching, say two years worth of data and compute these values in
Perl as rrdtool would probably do this several orders of magnitude
more efficient.
Any help appreciated!
Bjørn
--
Bjørn Nordbø - IP Development - Nextra Norway
--
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
--
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