Cacti / plugin_thold

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

Thold 1.5.2 got the PHP Error warning #472

Closed Hsuanching closed 1 year ago

Hsuanching commented 3 years ago

Describe the bug Hi

We got the PHP ERROR WARNING on 1.5.2 when the thold was triggered. Also, we have no idea why the thold get the negative value. We 100% sure the value are positive value for our thold configuration.

The error messages and screenshot about this issue as below. 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3732]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler()) 2020/11/18 14:40:22 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /var/www/html/cacti/plugins/thold/thold_functions.php on line: 4111 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3731]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler()) 2020/11/18 14:40:22 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /var/www/html/cacti/plugins/thold/thold_functions.php on line: 4111 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3729]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler()) 2020/11/18 14:40:22 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /var/www/html/cacti/plugins/thold/thold_functions.php on line: 4111 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3728]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler()) 2020/11/18 14:40:22 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /var/www/html/cacti/plugins/thold/thold_functions.php on line: 4111 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3726]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler()) 2020/11/18 14:40:22 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /var/www/html/cacti/plugins/thold/thold_functions.php on line: 4111 2020/11/18 14:40:22 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[802]:api_plugin_hook(), /lib/plugins.php[74]:api_plugin_run_plugin_hook(), /lib/plugins.php[177]:thold_poller_bottom(), /plugins/thold/includes/polling.php[45]:thold_check_all_thresholds(), /plugins/thold/includes/polling.php[522]:thold_check_threshold(), /plugins/thold/thold_functions.php[2047]:thold_modify_values_by_cdef(), /plugins/thold/thold_functions.php[3725]:thold_build_cdef(), /plugins/thold/thold_functions.php[4076]:thold_rpn(), /plugins/thold/thold_functions.php[4111]:CactiErrorHandler())

Screenshots messageImage_1606721270741

To Reproduce Steps to reproduce the behavior:

  1. Create a new threshold
  2. Edit the thold trigger
  3. Waiting for the alarm
  4. See error

Expected behavior Work fine without Error

Plugin (please complete the following information):

Desktop (please complete the following information):

TheWitness commented 3 years ago

Update to the latest develop branch. There has been some work around this topic in the last few days. Report back.

Hsuanching commented 3 years ago

Hi,

Thanks for your reply. We did try to develop branch. This issue still exists.

messageImage_1606789459256

messageImage_1606789475998

jckruger commented 3 years ago

I had a similar issue and what I did was disable and uninstall the thold plugin and then remove the plugin folder completely. I then recopied the files making sure they are 755 Directory and 644 files. I re-enabled and re-installed and checked again. It seems that there is a table entry missing in the Cacti Settings table. I added a new entry called thold_from_email and put in a correct email address and it started to work. Maybe that will fix it. It did for me.

jckruger commented 3 years ago

I found this bit in the \includes\database.php file

$e = strtolower(db_fetch_cell("SELECT `value` FROM settings WHERE `name` = 'thold_from_email'"));
        if ($e == 'cacti@cactiusers.org') {
            db_execute("UPDATE settings SET `value`='Cacti@cacti.net' WHERE `name`='thold_from_email'");
TheWitness commented 3 years ago

I found this bit in the \includes\database.php file


$e = strtolower(db_fetch_cell("SELECT `value` FROM settings WHERE `name` = 'thold_from_email'"));
if ($e == '[cacti@cactiusers.org](mailto:cacti@cactiusers.org)') {
db_execute("UPDATE settings SET `value`='[Cacti@cacti.net](mailto:Cacti@cacti.net)' WHERE `name`='thold_from_email'");

That's some grimy old logic, once you've configured things correctly, that should never happen. I think it was added early on as @cigamit was getting a bunch of emails of people who first installed thold and did not know what they were doing. It's annoying after a time.

TheWitness commented 3 years ago

This is a duplicate ticket. We are still tracing the issue.

TheWitness commented 3 years ago

Update to the latest thold_functions.php and let me know if these errors are cleared now.

Hsuanching commented 3 years ago

Hi,

Thanks for your reply.

We have updated the thold_functions.php and confirmed the logs. We didn't see some error message after updating the newer. But the thold list dashboard still shows the negative values. Did any solution to fix it? messageImage_1607313142456

rajkishore004 commented 1 month ago

i am getting following error.

2024-08-07 12:11:03 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'thold' 2024-08-07 12:11:03 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler()) 2024-08-07 12:11:03 - ERROR PHP ERROR in Plugin 'thold': Uncaught PDOException: There is no active transaction in /var/www/html/cacti/plugins/thold/includes/polling.php:253 Stack trace: #0 /var/www/html/cacti/plugins/thold/includes/polling.php(253): PDO->commit() #1 /var/www/html/cacti/lib/plugins.php(237): thold_poller_bottom() #2 /var/www/html/cacti/lib/plugins.php(95): api_plugin_run_plugin_hook() #3 /var/www/html/cacti/poller.php(862): api_plugin_hook() #4 {main} thrown in file: /var/www/html/cacti/plugins/thold/includes/polling.php on line: 253

xmacan commented 1 month ago

Please update to thold 1.8.1 (you have to cacti at least 1.2.25). 1.5.2 is very old.