Cacti / plugin_thold

Thold Plugin for Cacti
GNU General Public License v2.0
61 stars 60 forks source link

RPN expression unexpected result #613

Closed unka65 closed 10 months ago

unka65 commented 10 months ago

I have a threshold for the free space of a Windows server partition (the total space varies by server). I have something that works after modifying thold_functions.php so that the RPN expression returns the expected result. If there is a better way, then this is irrelevant. Otherwise, it would be great to resolve this so can update the plugin without debugging and modifying.

The threshold has data template Host MIB - Hard Disk Space, data field hdd_used and type High/Low. The RPN expression is: "|ds:hdd_total|,|ds:hdd_used|,-"

In debugging it, the value for hdd_total is not found (and so zero) and so the result is negative instead of the amount of free space.

For not understanding the data query process and storage, if the value is not found, I get the value more direct at that place in the code. I change the code in two sections to get it to work: thold_calculate_expression() and get_current_value()

Should an RPN expression like that return the expected result?

The RPN Expression popup help seems to include the data sources but mine has HTML code around the values (PHP 8.2, Cacti 1.2.25 manual update over Debian package 1.2.24 install and so might not be completely updated).

image

TheWitness commented 10 months ago

Oh lovely :). I can confirm that it busted. Thanks for reporting. Not very readable in the Dark theme I have to admit.

TheWitness commented 10 months ago

Resolved.