display a value only if it fits into the current scale

View: New views
4 Messages — Rating Filter:   Alert me  

display a value only if it fits into the current scale

by Karl Fischer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I'm using rrdtool 1.23 and I'd like to display a value as LINE1 *only*
if it fits into the current scale without affecting the scale (pretty
much like HRULE, however, the value is going to be calculated and may
change over time, so I can't use HRULE ...

Therefor I need to know, what my current (y) scale is, so I tried to
use MAXIMUM as a workaround, but that doesn't work since VDEF variables
cannot be used in CDEF as it seems ... :-(

theoretical idea to display a warning line at 90% of max cap only if
the used cap gets any near the 90% limit (so the warning line itself
doesn't affect the scale):

DEF:maxcap=some.rrd:maxcapacity:LAST
DEF:usedcap=some.rrd:usedcapacity:LAST
CDEF:warnlimit=maxcap,0.9,*
CDEF:help=warnlimit,0.9,*
VDEF:usedmax=usedcap,MAXIMUM
CDEF:warnline=usedmax,help,GT,warnlimit,UKNN,IF  # this doesn't work
AREA:usedcap#0000ff:used capacity
LINE1:warnline#ff0000:90% full


this works, but it doesn't reflect changes in maxcap over time

DEF:maxcap=some.rrd:maxcapacity:LAST
DEF:usedcap=some.rrd:usedcapacity:LAST
CDEF:warnlimit=maxcap,0.9,*
VDEF:warnline=warnlimit,MAXIMUM
AREA:usedcap#0000ff:used capacity
HRULE:warnline#ff0000:90% full


any idea of how to achieve this?

many thanks

- Karl

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: display a value only if it fits into the current scale

by Alex van den Bogaerdt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jul 04, 2008 at 01:43:45PM +0200, Karl Fischer wrote:

> I'm using rrdtool 1.23 and I'd like to display a value as LINE1 *only*
> if it fits into the current scale without affecting the scale (pretty
> much like HRULE, however, the value is going to be calculated and may
> change over time, so I can't use HRULE ...
>
> Therefor I need to know, what my current (y) scale is, so I tried to
> use MAXIMUM as a workaround, but that doesn't work since VDEF variables
> cannot be used in CDEF as it seems ... :-(
>
> theoretical idea to display a warning line at 90% of max cap only if
> the used cap gets any near the 90% limit (so the warning line itself
> doesn't affect the scale):
>
> DEF:maxcap=some.rrd:maxcapacity:LAST
> DEF:usedcap=some.rrd:usedcapacity:LAST
> CDEF:warnlimit=maxcap,0.9,*
> CDEF:help=warnlimit,0.9,*
> VDEF:usedmax=usedcap,MAXIMUM
> CDEF:warnline=usedmax,help,GT,warnlimit,UKNN,IF  # this doesn't work
> AREA:usedcap#0000ff:used capacity
> LINE1:warnline#ff0000:90% full

What is version 1.23 and does it know VDEF ?

Does your CDEF:warnline work when you change 'usedmax' in a number ?

see attached files which I just created as a test (using 1.2.12, which
just happened to be in my path)

--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/

#!/bin/bash

S=1215122400

rrdtool create test.rrd \
--start $S \
--step 60 \
DS:max:GAUGE:600:U:U \
DS:use:GAUGE:600:U:U \
RRA:AVERAGE:0:1:5

E=$S


E=$((E+60));rrdtool update test.rrd $E:50:44
E=$((E+60));rrdtool update test.rrd $E:100:45
E=$((E+60));rrdtool update test.rrd $E:100:46
E=$((E+60));rrdtool update test.rrd $E:50:47
E=$((E+60));rrdtool update test.rrd $E:50:40

rrdtool graph test.png \
--start $S \
--end $E \
DEF:max=test.rrd:max:AVERAGE \
DEF:use=test.rrd:use:AVERAGE \
CDEF:warnlimit=max,0.9,* \
CDEF:helplimit=warnlimit,0.9,* \
VDEF:usemax=use,MAXIMUM \
CDEF:warnline=usemax,helplimit,GT,warnlimit,UNKN,IF \
COMMENT:"                    max     avg     min\n" \
AREA:use#0000FF:"Used Capacity" \
GPRINT:use:MAX:%6.2lf \
GPRINT:use:AVERAGE:%6.2lf \
GPRINT:use:MIN:%6.2lf\\n \
LINE1:warnline#FF0000:"90 perct full"  \
GPRINT:warnline:MAX:%6.2lf \
GPRINT:warnline:AVERAGE:%6.2lf \
GPRINT:warnline:MIN:%6.2lf\\n \
COMMENT:DEBUG\\:helplimit \
GPRINT:helplimit:MAX:%6.2lf \
GPRINT:helplimit:AVERAGE:%6.2lf \
GPRINT:helplimit:MIN:%6.2lf\\n \
COMMENT:DEBUG\\:warnlimit \
GPRINT:warnlimit:MAX:%6.2lf \
GPRINT:warnlimit:AVERAGE:%6.2lf \
GPRINT:warnlimit:MIN:%6.2lf\\n \
COMMENT:DEBUG\\:"usemax   " \
GPRINT:usemax:%6.2lf \



_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

test.png (17K) Download Attachment
test.rrd (1K) Download Attachment

Re: display a value only if it fits into the current scale

by Karl Fischer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alex van den Bogaerdt wrote:

> On Fri, Jul 04, 2008 at 01:43:45PM +0200, Karl Fischer wrote:
>
>> I'm using rrdtool 1.23 and I'd like to display a value as LINE1 *only*
>> if it fits into the current scale without affecting the scale (pretty
>> much like HRULE, however, the value is going to be calculated and may
>> change over time, so I can't use HRULE ...
>>
>> Therefor I need to know, what my current (y) scale is, so I tried to
>> use MAXIMUM as a workaround, but that doesn't work since VDEF variables
>> cannot be used in CDEF as it seems ... :-(
>>
>> theoretical idea to display a warning line at 90% of max cap only if
>> the used cap gets any near the 90% limit (so the warning line itself
>> doesn't affect the scale):
>>
>> DEF:maxcap=some.rrd:maxcapacity:LAST
>> DEF:usedcap=some.rrd:usedcapacity:LAST
>> CDEF:warnlimit=maxcap,0.9,*
>> CDEF:help=warnlimit,0.9,*
>> VDEF:usedmax=usedcap,MAXIMUM
>> CDEF:warnline=usedmax,help,GT,warnlimit,UKNN,IF  # this doesn't work
>> AREA:usedcap#0000ff:used capacity
>> LINE1:warnline#ff0000:90% full


Thanks Alex for looking into it ...

unfortunately it doesn't quite what I want and I'm still failing to tweak
it that way ...
In your example there's a line at 45, but it should be at 90 (so outside
of the visible area, since the biggest value for use is 47 ...
(pretty similar to what HRULE:90 would do ...)

to stick with your (slighly modified) example of:

E=$S
E=$((E+60));rrdtool update test.rrd $E:50:44
E=$((E+60));rrdtool update test.rrd $E:50:45
E=$((E+60));rrdtool update test.rrd $E:50:46
E=$((E+60));rrdtool update test.rrd $E:100:47
E=$((E+60));rrdtool update test.rrd $E:100:40

up to t=$S + 180 I would like to have a line at 45 (90% of max which is 50)
and then I would like to have the warnline at 90 (90% of max) but this part
sould be invisible (outside of the graphing area) unless the 'use' value gets
any near the limit (90% of warn)

In other words: it doesn't make sense to expand the scale to 90 just to be
able to show the warning line of '90% full' if the current usage is way below.

Show the user the warning line if he get's near to 90% of his filesystem size.
(dependend on the current filesystem size)

So I need to find the max value for 'use' in the current timerange and display
the warn-line only if 'maxuse > 90% of warn' ...

I'm trying to change the example accordingly and repost ...


> What is version 1.23 and does it know VDEF ?

I'm sorry, should have been RRDtool 1.2.23


- Karl

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: display a value only if it fits into the current scale

by Karl Fischer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Karl Fischer wrote:

> Alex van den Bogaerdt wrote:
>> On Fri, Jul 04, 2008 at 01:43:45PM +0200, Karl Fischer wrote:
>>
>>> I'm using rrdtool 1.23 and I'd like to display a value as LINE1 *only*
>>> if it fits into the current scale without affecting the scale (pretty
>>> much like HRULE, however, the value is going to be calculated and may
>>> change over time, so I can't use HRULE ...
>>>
>>> Therefor I need to know, what my current (y) scale is, so I tried to
>>> use MAXIMUM as a workaround, but that doesn't work since VDEF variables
>>> cannot be used in CDEF as it seems ... :-(
>>>
>>> theoretical idea to display a warning line at 90% of max cap only if
>>> the used cap gets any near the 90% limit (so the warning line itself
>>> doesn't affect the scale):
>>>
>>> DEF:maxcap=some.rrd:maxcapacity:LAST
>>> DEF:usedcap=some.rrd:usedcapacity:LAST
>>> CDEF:warnlimit=maxcap,0.9,*
>>> CDEF:help=warnlimit,0.9,*
>>> VDEF:usedmax=usedcap,MAXIMUM
>>> CDEF:warnline=usedmax,help,GT,warnlimit,UKNN,IF  # this doesn't work
>>> AREA:usedcap#0000ff:used capacity
>>> LINE1:warnline#ff0000:90% full
>
>
> Thanks Alex for looking into it ...

Alex,

I'm sorry, I fooled myself ... :-(
Your example does exactly what I want ...

Thank you.

- Karl



_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users