Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
Post general support questions here that do not specifically fall into the Linux or Windows categories.
Moderators: Developers , Moderators
Cybernet1k
Posts: 7 Joined: Thu Jan 24, 2013 10:34 am
Post
by Cybernet1k » Mon Feb 25, 2013 8:14 am
Hello! I can not make a simple function:
If CURRENT_DATA_SOURCE = 4 then 1 else 0 .
In
http://oss.oetiker.ch/rrdtool/tut/rpntutorial.en.html
..."2,20,200,IF" ("if 2 then 20 else 200") evaluates to 20. And "0,1,2,IF" ("if 0 then 1 else 2) evaluates to 2...
But in debug mode "cdef=4,1,0,IF": RRDTool Says: ERROR: rpn expressions without DEF or CDEF variables are not supported.
Please help...Need cdef : if CURRENT_DATA_SOURCE = 4 then 1 else 0
victorantunes
Cacti User
Posts: 111 Joined: Fri Sep 28, 2012 6:52 pm
Post
by victorantunes » Mon Feb 25, 2013 8:47 am
you can't have a CDEF without variables
try:
CURRENT_DATA_SOURCE,POP,4,1,0,IF
Cybernet1k
Posts: 7 Joined: Thu Jan 24, 2013 10:34 am
Post
by Cybernet1k » Mon Feb 25, 2013 9:32 am
victorantunes wrote: you can't have a CDEF without variables
try:
CURRENT_DATA_SOURCE,POP,4,1,0,IF
In this case, the graph value is only "1".
Cybernet1k
Posts: 7 Joined: Thu Jan 24, 2013 10:34 am
Post
by Cybernet1k » Tue Feb 26, 2013 2:19 am
The device gives the SNMP values from 1 to 5. I need to add cdef with a condition: If the current value is 4 then 1, else 0. For a start, used to do so: if current value used not 4 then 0. You are from Russia?
Cybernet1k
Posts: 7 Joined: Thu Jan 24, 2013 10:34 am
Post
by Cybernet1k » Tue Feb 26, 2013 3:27 am
Understood ...
cdef=CURRENT_DATA_SOURCE,3,EQ,3,0,IF
Code: Select all
if ( CURRENT_DATA_SOURCE = 3 ) then
value = 3
else
value = 0
Users browsing this forum: No registered users and 2 guests