[rrd-users] Re: How do I print totals
Clarence Hart
rti1clh at ismd.ups.com
Wed Jul 25 16:25:22 MEST 2001
Alex & Owen --> Thanks for answering my request for help...
Owen, I've tried the :
"CDEF:totalP=PREV,PREV,0,IF,FromDEF,1800,*,+"
and it still returns NaN. This really looks like it should work.
Is there some way to print out the values in debug mode to see
what the heck the engine is doing to the variables involved?
There has to be some way to hold a PREVIOUS value and re-add it
to the new DEF value. damn....
I was thinking I could access the rrd file before drawing the graph to get the
total but its alittle inefficient.
This would work in perl to display all datapoints and a SUM.
--------------
foreach $databases (@database) {
$foobar="${databases}/1.rrd";
my ($start,$step,$names,$data) = RRDs::fetch $foobar , "AVERAGE", "-s
$starttime", "-e $endtime";
print "<p ID=hdr>Start: ", scalar localtime($start), "
($start)<br>\n";
print "Step size: $step seconds<br>\n";
print "DS names: ", join (", ", @$names)."<br>\n";
print "Data points: ", $#$data + 1, "<br>\n";
print "Data: <br>\n";
foreach my $line (@$data) {
print " ", scalar localtime($start), " ($start) ";
$start += $step;
foreach my $val (@$line) {
printf "%12.1f ", $val*1800;
$tP += $val*1800; # <---- Add running total here
printf "%12.1f ", $tP; # <---- Print it here
}
print "<br>\n";
}
print "</p>\n";
}
----------------------------
Clarence Hart
>Date: Tue, 24 Jul 2001 18:16:36 -0700
>From: Owen DeLong <owen at delong.com>
>X-Accept-Language: en
>MIME-Version: 1.0
>To: Alex van den Bogaerdt <alex at slot.hollandcasino.nl>
>CC: Clarence Hart <rti1clh at ismd.ups.com>, RRD users <rrd-users at list.ee.ethz.ch>
>Subject: Re: [rrd-users] Re: How do I print totals
>Content-Transfer-Encoding: 7bit
>X-Sorted: Bulk
>
>
>> #!/bin/bash
>>
>> PIX=400 # width of the graph
>> STEPS=3 # PDPs per CDP
>> STEPSIZE=300 # duration of one PDP
>> CDP=$((STEPSIZE*STEPS)) # seconds shown per pixel
>> NOW=`date +%s` # current time in seconds since epoch format
>> NOW=$((NOW/CDP)) # divide followed ...
>> NOW=$((NOW*CDP)) # ... by multiply.
>> DURATION=$((PIX*CDP)) # total time span of graph
>>
>> rrdtool graph picture.png --start end-$DURATION --end $NOW --width $PIX \
>> --img-format PNG ...
>> ... DEF:pagespersecond=myprinter.rrd:pagecounter:AVERAGE \
>> CDEF:total=pagespersecond,$DURATION \
>> GPRINT:total:"During this interval %6.0lf pages have been printed\n"
>> ---cut here---
>>
>Even if your math works out (which I expect it does), you forgot to
>multiply
>in the CDEF (total=pagespersecond,$DURATION,*), and I believe you've
>made an
>unnecessary complexity in requiring an external script that knows alot
>about the
>graph. I believe his CDEF would do it if he got around a couple of
>hurdles.
>
>If he uses PREV, but primes the pump with a ...=PREV,PREV,0,IF..., I
>think
>that will solve his NaN problem. Then, I think he can simply add up the
>rate*seconds amounts for each CDP (...,rate,seconds,*,+), for a total
>solution of:
>
>CDEF:total=PREV,PREV,0,IF,rate,seconds,*,+
>
>Am I missing something?
>
>Owen
>
>
>--
>***********************************************************************
>"Every time you turn on your new car, you're turning on 20
> microprocessors. Every time you use an ATM, you're using a computer.
> Every time I use a settop box or game machine, I'm using a computer.
> The only computer you don't know how to work is your Microsoft
> computer, right?"
> - Scott McNealy, CEO of Sun Microsystems, Inc.,
> from an April 1997 interview in Upside Magazine
>
>***********************************************************************
>Microsoft CEO Bill Gates is optimistic about Contraceptive99's
>potential.
>He recently said, "Our contraceptive products will help users do to
>each other what we've been doing to our customers for years."
>
>The mail above is sent from my personal account and represents my own
>views. It may or may not reflect the opinions of Exodus Communications,
>Jin Ho, Mo Sabourian, Tony Massing, Morris Taradalsky, or any other
>employee, officer, subsidiary, acquisition, member, partner, aff
Clarence Hart
UPS
Office: 410-560-4182
Fax: 410-560-4329
chart at ups.com
--
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