plugin_thold icon indicating copy to clipboard operation
plugin_thold copied to clipboard

PHP Error with THOLD Cacti Plugin

Open msfraticelli opened this issue 10 months ago • 19 comments

I've installed the new Cacti 1.2.30 version on a Debian 6.1.135-1 server. The php version installed is 8.2.28. The THOLD plugin installed is the 1.8.2. These packages were downloaded from the latest Github available versions.

I'm observing the threshold plugin gets disabled sporadically. According to the logs, the errors are the following:

2025-06-25 07:18:22 - CMDPHP ERROR: debounce key was truncated from debounce_page_error_thold_graph.php?headercontent=true to debounce_page_error_thold_graph.php?headercontent= Backtrace: (/help.php[43]:debounce_run_notification(), /lib/functions.php[7442]:cacti_debug_backtrace()) 2025-06-25 07:18:22 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'thold' 2025-06-25 07:18:22 - ERROR PHP ERROR in Plugin 'thold': Uncaught TypeError: Unsupported operand types: string * int in /var/www/html/cacti/plugins/thold/thold_graph.php:388 Stack trace: #0 /var/www/html/cacti/plugins/thold/thold_graph.php(56): tholds() #1 {main} thrown in file: /var/www/html/cacti/plugins/thold/thold_graph.php on line: 388

Any idea what can cause the errors or why the cacti application disables the plugin?

Thank you,

msfraticelli avatar Jun 25 '25 22:06 msfraticelli

Please use fixed version from https://github.com/Cacti/plugin_thold/ (develop branch)

xmacan avatar Jun 26 '25 06:06 xmacan

Good morning, I believe that is the same version I downloaded a few months ago. Was there a recent change to the same version?

Thank you for your response.

msfraticelli avatar Jun 26 '25 12:06 msfraticelli

Someone told there's a more stable php version than the 8.2.28 version I have installed. Can this be the case?

msfraticelli avatar Jun 26 '25 12:06 msfraticelli

Version is the same but in develop branch are fixes for your problem. Download it and replace files

xmacan avatar Jun 26 '25 13:06 xmacan

@xmacan, is it time for a release?

TheWitness avatar Jun 27 '25 12:06 TheWitness

I don't know about any problems with actual develop.

xmacan avatar Jun 27 '25 12:06 xmacan

Thank you for your support. I've downloaded the develop version and replaced the files. I'll monitor the progress.

msfraticelli avatar Jun 27 '25 13:06 msfraticelli

Good morning, after installing the develop branch version I did notice a more stable behavior but still every 2 or 3 days the plugin gets disabled. Now the problem I have is that I don't see any error messages in the cacti log.

If there's any idea that can help resolve this issue, I'd appreciate some insight.

Thank you.

msfraticelli avatar Jul 25 '25 15:07 msfraticelli

Search for "DISABLING" in your Cacti logs. When you find the file that includes it, open the file and there will be a ERROR and backtrace just before the DISABLING term. Post that here.

TheWitness avatar Jul 25 '25 17:07 TheWitness

I had to retrieve the information several days back with the backup files.

07/16/2025 14:02:01 - ERROR PHP ERROR in Plugin 'thold': Uncaught TypeError: Unsupported operand types: string * int in /var/www/html/cacti/plugins/thold/thold_graph.php:388 Stack trace: #0 /var/www/html/cacti/plugins/thold/thold_graph.php(56): tholds() #1 {main} thrown in file: /var/www/html/cacti/plugins/thold/thold_graph.php on line: 388 07/16/2025 14:02:01 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler()) 07/16/2025 14:02:01 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'thold' 07/16/2025 14:02:01 - SYSTEM WARNING: Primary Admin account notifications disabled! Unable to send administrative Email. 07/16/2025 14:02:01 - CMDPHP WARNING: Cacti Page:thold_graph.php?headercontent=true for User:noc Generated a Fatal Error:500 07/16/2025 14:02:01 - CMDPHP ERROR: debounce key was truncated from debounce_page_error_thold_graph.php?headercontent=true to debounce_page_error_thold_graph.php?headercontent= Backtrace: (/help.php[43]:debounce_run_notification(), /lib/functions.php[7442]:cacti_debug_backtrace()) 07/16/2025 14:02:01 - SYSTEM WARNING: Primary Admin account notifications disabled! Unable to send administrative Email.

Thanks for your reply.

msfraticelli avatar Jul 25 '25 17:07 msfraticelli

Are you running this on top of Cacti 1.3?

TheWitness avatar Jul 25 '25 18:07 TheWitness

Post lines 377 through 381 in thold_graph.php.

TheWitness avatar Jul 25 '25 18:07 TheWitness

I'm running on Cacti 1.2.30. The lines are the following:

    if (get_request_var('rows') == -1) {
            $rows = read_config_option('num_rows_table');
    } else {
            $rows = get_request_var('rows');
    }

msfraticelli avatar Jul 25 '25 18:07 msfraticelli

@msfraticelli It was fixed in develop few weeks ago. Update from develop branch or change lines: if (get_request_var('rows') == -1) { $rows = intval(read_config_option('num_rows_table')); } else { $rows = intval(get_request_var('rows')); }

Do you also have installed and enabled monitor plugin?

xmacan avatar Jul 28 '25 08:07 xmacan

I've update the plugin with the develop branch version. I appreciate your support.

Yes, I do have installed and enabled the monitor plugin. It's on version 2.8.

Thank you.

msfraticelli avatar Jul 28 '25 09:07 msfraticelli

@msfraticelli It was fixed in develop few weeks ago. Update from develop branch or change lines: if (get_request_var('rows') == -1) { $rows = intval(read_config_option('num_rows_table')); } else { $rows = intval(get_request_var('rows')); }

Do you also have installed and enabled monitor plugin?

Just so you know, after applying the new develop version, the plugin has maintained stable. Thank you.

msfraticelli avatar Aug 06 '25 14:08 msfraticelli

I've noticed this happen myself. It happens after a session timeout and for some reason, the session is renewed and the stored version of the value becomes corrupted. @xmacan, I think we need to do something in the read_config_option() function call to validate this setting as it's tied to so many things until such time as we find the root cause of the issue.

TheWitness avatar Aug 07 '25 13:08 TheWitness

Sorry guys. Super busy these days.

TheWitness avatar Aug 07 '25 13:08 TheWitness

It hasn't happened to me yet, but several people are dealing with it. The problem with the "rows" variable was also in the monitor plugin, but I fixed it there. I think it was possible to save the word 'default' instead of a number as the number of rows. But why did it start happening only now? What is it related to?

xmacan avatar Aug 07 '25 14:08 xmacan