CDEFs not working
Moderators: Developers, Moderators
CDEFs not working
Just tried to get a percentage from diskspace values, by generating a CDEF as follows:
cdef=CURRENT_DATA_SOURCE,CURRENT_GRAPH_MAXIMUM_VALUE,/,100,*
this works for normal cacti, but not for the thold plugin
in the plugin I get a division by zero error.
after looking at the thold source, is looks like the plugin never grabs the values from the rrd file
cdef=CURRENT_DATA_SOURCE,CURRENT_GRAPH_MAXIMUM_VALUE,/,100,*
this works for normal cacti, but not for the thold plugin
in the plugin I get a division by zero error.
after looking at the thold source, is looks like the plugin never grabs the values from the rrd file
Re: CDEFs not working
The thold plugin currently only does the basic CDEF functions, so anything with CURRENT_GRAPH_MAXIMUM_VALUE doesn't work (basically only CURRENT_DATA_SOURCE and simple math equations). I have to calculate the CDEF manually for now, which I can tell you is a big pain.wwolkers wrote:Just tried to get a percentage from diskspace values, by generating a CDEF as follows:
cdef=CURRENT_DATA_SOURCE,CURRENT_GRAPH_MAXIMUM_VALUE,/,100,*
this works for normal cacti, but not for the thold plugin
in the plugin I get a division by zero error.
after looking at the thold source, is looks like the plugin never grabs the values from the rrd file
CDEF patch
the attached patch will add CDEF support in a better way than it is now
at least this gives you the CURRENT_DATA_SOURCE etc support.
at least this gives you the CURRENT_DATA_SOURCE etc support.
- Attachments
-
- thold-functions.php.patch
- thold-functions.php patch1
- (2.12 KiB) Downloaded 789 times
Well, after a few minor modifications, this patch is now in the SVN version.
The modifications aren't because of problems with your code, but I had to adapt it to the new way that thold checks (it now grabs the current data from the poller output instead of directly from the rrd file).
So far so good!
The modifications aren't because of problems with your code, but I had to adapt it to the new way that thold checks (it now grabs the current data from the poller output instead of directly from the rrd file).
So far so good!
Hi cigamit,cigamit wrote:Well, after a few minor modifications, this patch is now in the SVN version.
The modifications aren't because of problems with your code, but I had to adapt it to the new way that thold checks (it now grabs the current data from the poller output instead of directly from the rrd file).
So far so good!
Where can I get this patch please ?
Thanks.
I need to do the same sort of thing for interface traffic. the 0.3.0 version I just downloaded has files with a timestamp of july 25th, which leads me to believe the answer is "yes". I already have a bandwidth percentage CDEF I'm using for the graphs, so once I apply the patch can I just put "90" in for the high threshold and it will alert me when the traffic goes above 90%?
edited to add: well, I decided to go ahead and try it just for fun, and I got a divide by zero after applying the patch.
Warning: Division by zero in /www/htdocs/cacti-0.8.6h/plugins/thold/thold-functions.php on line 108
here's my percentage CDEF:
edited to add: well, I decided to go ahead and try it just for fun, and I got a divide by zero after applying the patch.
Warning: Division by zero in /www/htdocs/cacti-0.8.6h/plugins/thold/thold-functions.php on line 108
here's my percentage CDEF:
- Attachments
-
- thold-problem.jpg (59.48 KiB) Viewed 13428 times
Last edited by daemon on Thu Nov 02, 2006 3:56 pm, edited 1 time in total.
cacti 0.8.6h | cactid 0.8.6g
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
I took a wild guess and decided to change |query_ifspeed| to CURRENT_DS_MAXIMUM_VALUE, and now it isn't getting divide by zero errors but the current value is always 800 for almost all the interfaces. since the formula is (current value/ifspeed)*8*100, it's almost as if (current value/ifspeed) is getting rounded up to 1 or something. if I graph the values using the same CDEF they show up fine, so I'm at a bit of a loss here.
I'm also curious, if I use CURRENT_DS_MAXIMUM_VALUE, and the speed of the interface changes, will this value update or do I have to refresh the indexes using the green circle thingie?
I'm also curious, if I use CURRENT_DS_MAXIMUM_VALUE, and the speed of the interface changes, will this value update or do I have to refresh the indexes using the green circle thingie?
cacti 0.8.6h | cactid 0.8.6g
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
I've done some more digging and after examining thold-functions.php I think I found where the problem lies. here's an excerpt of some print statements I threw into the file:
for some reason, in the case statement for CURRENT_DS_MAXIMUM_VALUE it's coming back with CURRENT_DATA_SOURCE, which is where the 800 is coming from (CURRENT_DATA_SOURCE / CURRENT_DATA_SOURCE * 800). any idea why $cdef['value'] = get_current_value($rra, 'rrd_maximum', 0); would be returning the same number as $cdef['value'] = get_current_value($rra, $ds, 0);?
Code: Select all
CURRENT_DATA_SOURCE
CDEF value: 276.656
CURRENT_DS_MAXIMUM_VALUE
CDEF value: 276.656
oldvalue: 276.656
value: 276.656
id: 17
rra: 2354
ds: traffic_in
cdef[value]: 3
entering thold_rpn...x is 276.656, y is 276.656, z is 4
returning 276.656 / 276.656
entering thold_rpn...x is 1, y is 100, z is 3
returning 1 * 100
entering thold_rpn...x is 100, y is 8, z is 3
returning 100 * 8
cacti 0.8.6h | cactid 0.8.6g
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
I think that you made the same mistake that I did daemon, you used the CURRENT_DS_MAXIMUM_VALUE when you should have used the CURRENT_GRAPH_MAXIMUM_VALUE.
At least that is what I belevide that I did wrong since I have one machine that also triggers at 100% I recently changed the CDEF and will see in a few minutes if that was the cause
At least that is what I belevide that I did wrong since I have one machine that also triggers at 100% I recently changed the CDEF and will see in a few minutes if that was the cause
yea, CURRENT_GRAPH_MAXIMUM_VALUE didn't work for me either. the thing that really confuses me is that CURRENT_DS_MAXIMUM_VALUE works just fine when it comes to getting the values on a graph.
cacti 0.8.6h | cactid 0.8.6g
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
Who is online
Users browsing this forum: No registered users and 0 guests