[rrd-users] display a value only if it fits into the current scale

Alex van den Bogaerdt alex at ergens.op.het.net
Fri Jul 4 14:19:24 CEST 2008


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/
-------------- next part --------------
#!/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 \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 13285 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20080704/af2b7790/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.rrd
Type: application/octet-stream
Size: 936 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20080704/af2b7790/attachment-0001.obj 


More information about the rrd-users mailing list