CDEF : MAX - MIN ????
Moderators: Developers, Moderators
CDEF : MAX - MIN ????
Hi,
I just want to create a cdef stuff to display (with GPRINT) the difference between the max value of a DS and the MIN value of the same DS on a graph.
I tried with :
Item 1# special data source: CURRENT_DS_MAX_VALUE
Item 2# special data source: CURRENT_DS_MIN_VALUE
Item 3# Operator: -
but it doesnt seem to work : ERROR: rpn expressions without DEF or CDEF variables are not supported
Does anyone know how to do what I want ?
Thx
I just want to create a cdef stuff to display (with GPRINT) the difference between the max value of a DS and the MIN value of the same DS on a graph.
I tried with :
Item 1# special data source: CURRENT_DS_MAX_VALUE
Item 2# special data source: CURRENT_DS_MIN_VALUE
Item 3# Operator: -
but it doesnt seem to work : ERROR: rpn expressions without DEF or CDEF variables are not supported
Does anyone know how to do what I want ?
Thx
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Did you _append_ it to the maths given above?
Please see http://docs.cacti.net/manual:087:6_refe ... cdef#cdefs for docs
Reinhard
Please see http://docs.cacti.net/manual:087:6_refe ... cdef#cdefs for docs
Reinhard
Re: CDEF : MAX - MIN ????
I'm also loooking for a nearly exact solution, but it won't work.
I want to calculate the value of LAST-MIN= and GPRINT the result.
The docs you've posted are very interesting, but I haven't found any way to calculate/get the MIN-Value for my calculation.
I've tried the following to calculate MAX-MIN (Wich is also OK for me, because in 99,999% of all cases LAST=MAX because the value is always increasing)
but this results in "0", what was predictable.
Any ideas woud be very useful Thanks!
I want to calculate the value of LAST-MIN= and GPRINT the result.
The docs you've posted are very interesting, but I haven't found any way to calculate/get the MIN-Value for my calculation.
I've tried the following to calculate MAX-MIN (Wich is also OK for me, because in 99,999% of all cases LAST=MAX because the value is always increasing)
Did you _append_ it to the maths given above?
Code: Select all
Item 1# special data source: CURRENT_DS_MAX_VALUE
Item 2# special data source: CURRENT_DS_MIN_VALUE
Item 3# Operator: -
Item 4# Custom String: a
Item 5# Operator: +
Item 6# Custom String: a
Item 7# Operator: -
Any ideas woud be very useful Thanks!
Regards,
Thomas
Thomas
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: CDEF : MAX - MIN ????
Well, let's go this way:
A CDEF at least needs the reference to a single DEF, let's take def = a for that.
In the case given, you don't really NEED that DEF, it's required only to satisfy rrdtool requirements. So far, the CDEF should look like(This differs from the notation above, but this math still yields the result "0").
Now you add what you really need, e.g.which makes all in all
R.
A CDEF at least needs the reference to a single DEF, let's take def = a for that.
In the case given, you don't really NEED that DEF, it's required only to satisfy rrdtool requirements. So far, the CDEF should look like
Code: Select all
CDEF=a,a,-
Now you add what you really need, e.g.
Code: Select all
CURRENT_DS_MAX_VALUE ,CURRENT_DS_MIN_VALUE,-
Code: Select all
CDEF=a,a,-,CURRENT_DS_MAX_VALUE ,CURRENT_DS_MIN_VALUE,-
Re: CDEF : MAX - MIN ????
Hi Reinhard,
thanks for your fast relpy!
Ah ok, I understand the meaning of the "a"!
I've tested your code, but maybe I've made some not quite correct, because it won't wok:
I think that
is the Problem, CURRENT_DS_MAX_VALUE/CURRENT_DS_MIN_VALUE seems to be 0! But why? Do I have to Re-Create the Graph?
Ive also switched to CF AVERAGE, MIN and MAX, but I think thats not the problem, isn't it?
RRDtool says
thanks for your fast relpy!
Ah ok, I understand the meaning of the "a"!
I've tested your code, but maybe I've made some not quite correct, because it won't wok:
Code: Select all
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1334574279 \
--end=1334660679 \
--title='WBB3 - Registered Members' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale \
COMMENT:"From 16/04/2012 13\:04\:39 To 17/04/2012 13\:04\:39\c" \
COMMENT:" \n" \
--vertical-label='Reg. Members' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:9: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/wbb3_members_299.rrd":"members":AVERAGE \
CDEF:cdefc='a,a,-,0,0,-' \
CDEF:cdefd='LTIME,604800,%,172800,GT,LTIME,604800,%,345600,LT,INF,UNKN,a,*,IF,UNKN,a,*,IF' \
LINE2:a#55D6D3FF:"Registered Members" \
GPRINT:a:LAST:"%8.0lf" \
GPRINT:cdefc:LAST:"Trend\:%8.0lf\n" \
LINE2:cdefd#750F7DFF:""
Code: Select all
CDEF:cdefc='a,a,-,0,0,-' \
Code: Select all
GPRINT:cdefc:LAST:"Trend\:%8.0lf\n" \
RRDtool says
Code: Select all
ERROR: RPN final stack size != 1
Regards,
Thomas
Thomas
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: CDEF : MAX - MIN ????
As the magic Cacti variable refer to current data source, it does matter which data source is related to the graph item where you're using this new CDEF. In case you didn't select any data source, the values will always be 0
R.
R.
Re: CDEF : MAX - MIN ????
OK, it seems I've done something wrong. I've selected a Data Source (at least I believe that I have set it correct) (see att.)
So I set the Data source to "none" (the cacti output isn't changing) and back to the correct one (the cacti output isn't changing again) - It seems that Cacti is ignoring this Setting, but why?
So I set the Data source to "none" (the cacti output isn't changing) and back to the correct one (the cacti output isn't changing again) - It seems that Cacti is ignoring this Setting, but why?
- Attachments
-
- Template.JPG (69.33 KiB) Viewed 4235 times
Regards,
Thomas
Thomas
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: CDEF : MAX - MIN ????
Oops, that's bad. The theory says, it should work. So I have to debug this. Please tell me your Cacti version
R.
R.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: CDEF : MAX - MIN ????
Give me some time, then. I'm away from my dev system 'til weekend
R.
R.
-
- Posts: 5
- Joined: Mon Apr 23, 2012 8:55 pm
Re: CDEF : MAX - MIN ????
So I have to debug this. Please tell me your Cacti version
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: CDEF : MAX - MIN ????
That's wrong, sorry. It should readgandalf wrote:Code: Select all
CDEF=a,a,-,CURRENT_DS_MAX_VALUE ,CURRENT_DS_MIN_VALUE,-
Code: Select all
CDEF=a,a,-,CURRENT_DS_MAX_VALUE ,CURRENT_DS_MIN_VALUE,-,+
R.
Who is online
Users browsing this forum: No registered users and 1 guest