thold constantly shutting down: DISABLING PLUGIN 'thold'
porklift opened this issue · comments
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.
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;
}
Thanks for the quick fix, it works now!
Case closed!