Cacti / plugin_thold

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

thold constantly shutting down: DISABLING PLUGIN 'thold' #646

Closed porklift closed 7 months ago

porklift commented 7 months ago

Cacti version 1.2.25 Thold version 1.5.2

Cacti Log:

2023-12-06 01:25:25 - ERROR PHP ERROR in Plugin 'thold': Uncaught TypeError: Unsupported operand types: string / string in /var/www/html/cacti/plugins/thold/thold_functions.php:1139 Stack trace: #0 /var/www/html/cacti/plugins/thold/includes/polling.php(399): thold_calculate_percent() #1 /var/www/html/cacti/lib/plu> 2023-12-06 01:25:25 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler()) 2023-12-06 01:25:25 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'thold'

Enable thold manually, but shuts down after a while.

xmacan commented 7 months ago

1.5.2 is very old and it seems that you have php version 8.x. Workaround: in file tohld_function.php change in function function thold_calculate_percent($thold, $currentval, $rrd_reindexed) { around line 1133: $t = $rrd_reindexed[$thold['local_data_id']][$thold['percent_ds']];

if ($t != 0) { $currentval = ($currentval / $t) * 100; } else { $currentval = 0; }

To new code: $t = (int) $rrd_reindexed[$thold['local_data_id']][$thold['percent_ds']];

if ($t > 0) { $currentval = ($currentval / $t) * 100; } else { $currentval = 0; }

porklift commented 7 months ago

Thanks for the quick fix, it works now!

porklift commented 7 months ago

Case closed!