Alex
the values are from a external program  which reports the status of a modem
call.
A log file is created form the program with samples every 15 mins.
So the program reports the following values 0,100, 200,300,400, 500, 600
depending on the status of the call.
The create is :
    RRDs::create ("$RRD", "-b", $START, "-s", 900,
    "DS:ds0:GAUGE:86400:U:U",
    "DS:ds1:GAUGE:86400:U:U",
    "RRA:AVERAGE:0.5:1:900",
    "RRA:MAX:0.5:1:900",
    "RRA:AVERAGE:0.5:6:900",
    "RRA:MAX:0.5:6:900",
    "RRA:AVERAGE:0.5:24:900",
    "RRA:MAX:0.5:24:900",
    "RRA:AVERAGE:0.5:288:900",
    "RRA:MAX:0.5:288:900");
The rrd is updated every 2 hours.
So, my objective is to plot the values (I hope  that the graph attached is
correct) and print the percentages of the values relative to the total number of
calls during predefined time periods (daily, weekly etc) and/or the number for
each value.
The number  is not printed . I am not so expirenced with PRN expression and is
most likely to make same mistakes.
The graph script is following :

rrdtool graph  /call.gif \
--width '500' \
--height '160' \
--start 'e-1w' \
--end 'n-3d' \
--title 'Call Success' \
'DEF:C=/path/callsuceess.rrd:ds0:MAX' \
'CDEF:num500=C,600,EQ,900,*' \
'CDEF:num500=C,500,EQ,900,*' \
'CDEF:num400=C,400,EQ,900,*' \
'CDEF:num300=C,300,EQ,900,*' \
'CDEF:num200=C,200,EQ,900,*' \
'CDEF:num100=C,100,EQ,900,*' \
'CDEF:num0=C,0,EQ,900,*' \
'AREA:C#00FF00:Call Success ' \
'GPRINT:C:MIN:(min=%3.2lf' \
'GPRINT:C:AVERAGE:ave=%3.2lf' \
'GPRINT:C:MAX:max=%3.2lf)' \
'COMMENT:\n' \
'GPRINT:num0:AVERAGE:0:%3.2lf' \
'GPRINT:num100:AVERAGE:100:%3.2lf' \
'COMMENT:\n' \
Any ideas ?  A sample image is attached.
Thanks in advance for your help
Best Regards

Paschalis
(Embedded image moved to file: pic18302.pcx)




I'm not sure if I got the question right.  Are you saying you only feed
rrdtool with the numbers 0,100,200,300,400,500,600 and 700 ?

If so:  are you aware of normalizing?  See the faq site if you aren't.

If you *are* aware and thus if you're certain you won't get unexpected
numbers, you could use CDEF instructions to do the trick.

Note: next is not tested.  I never tried it so just try and follow
the reasoning.  If I make a mistake somewhere, correct that mistake
and carry on.

First of all make sure the graph is correct.  Use appropriate
start and end times.  Appropriate is at exactly the right time,
for instance: 00:00 is correct while 00:01 is not.  You need to
know *exactly* the amount of time covered in the graph.

Lets work with an image with width 400, covering 120000 seconds.
This results in 120000/400 seconds per pixel which is 300 seconds
or 5 minutes.  This also assumes you have an RRA in that resolution.

Use CDEFs to remove all but one of the possible numbers.

1) fetch all values:
      DEF:ds0=/path/to/database.rrd:ds0:AVERAGE
2) remove all numbers except 700:
      CDEF:num700=ds0,700,EQ,400,*
   this means: if (value_of_ds0 == 700) then return 400 else return 0

Suppose ds0 was 700 during only one of the intervals.  The amount of
time it was this value is 300 seconds.  During 300 out of the 120000
seconds, the rate therefore is 400 in the CDEF.  The rate during the
other intervals is 0.

300 seconds at a rate of 400 per second makes a total of 120000.

When printing this total amount as an average, RRDtool will print "1".
This is exactly the amount of intervals where ds0 was 700.

Just one more:  if the amount of intervals being equal to 700 was 3,
the calculations are:  300*3*400=360000.  360000/120000=3.

Do the same for
   CDEF:num600=ds0,600,EQ,400,*
   CDEF:num500=ds0,500,EQ,400,*
   CDEF:num500=ds0,400,EQ,400,*
and so on.

Make sure to test the outcome.  The result when added should match
the total number:

CDEF:total=num000,num100,num200,num300,num400,num500,num600,num700,+++++++

Printing is done so:

GPRINT:num000:AVERAGE:"  0: %3.0lf\n"
GPRINT:num100:AVERAGE:"100: %3.0lf\n"
and so on.  Maybe you'd like to see fractions as well, use "%6.2lf"

If you want percentages, you should multiply by 100 and divide by the
total amount of intervals.  This would mean adding ",100,*,400,/" to
each CDEF.  However, that can be made more simple.  The result of the
CDEF upto and including "EQ" is one or zero.  The remainder would be
"400,*,100,*,400,/" which can be simplified into ",100,*".  Each CDEF
would therefore become "CDEF:numxxx=ds0,xxx,EQ,100,*". This has a
nice side effect as well: the equasion doesn't use the width of the
graph anymore.

Let me know how it turned out.  Perhaps you can produce a sample image
for the galery as well.
--
   __________________________________________________________________
 / [EMAIL PROTECTED]                  [EMAIL PROTECTED] \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi





-- Attached file removed by Listar and put at URL below --
-- Type: application/octet-stream
-- Size: 30k (31451 bytes)
-- URL : http://www.ee.ethz.ch/~slist/pantomime/pic18302.pcx


--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to