Thold 0.5.1 Baseline ReAlerts error log

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
mpccert
Posts: 3
Joined: Fri Jul 01, 2016 1:59 am

Thold 0.5.1 Baseline ReAlerts error log

Post by mpccert »

Hi,

I'm using thold 0.5.1 and using the baseline functionality. I'm now receiving error logs of Division by zero in /usr/share/cacti/site/plugins/thold/thold_functions.php on line 1708 which has a code:

line 1708
/* re-alert? */
$ra = ($item['bl_fail_count'] > $bl_fail_trigger && ($item['bl_fail_count'] % ($item['repeat_alert'] == '' ? $realert : $item['repeat_alert']) ) == 0);

The division by zero was triggered if I selected "NEVER" in the Re-Alert Cycle in the thold template. Setting other options other than "NEVER" will not trigger this division by zero error.

Also receiving Undefined variable: subject in /usr/share/cacti/site/plugins/thold/thold_functions.php on line 1764 pointing to the thold_log array "description". Variable $subject seems to be undefined since the $subject values is under the if conditions.

} else {
thold_log(array(
'type' => 1,
'time' => time(),
'host_id' => $item['host_id'],
'graph_id' => $graph_id,
'threshold_id' => $item['id'],
'threshold_value' => ($breach_up ? $item['thold_hi'] : $item['thold_low']),
'current' => $currentval,
'status' => ST_TRIGGERA,
'description' => $subject,
'emails' => $alert_emails));
}

fixed this by

adding this in line 1710 before the IF statement:

$subject = "ALERT: " . $item['name'] . ($thold_show_datasource ? " [$name]" : '') . ' ' . ($ra ? 'is still' : 'went') . ' ' . ($breach_up ? 'above' : 'below') . " calculated baseline threshold " . ($breach_up ? $item['thold_hi'] : $item['thold_low']) . " with $currentval";


and commented line 1715 inside the IF statement:

// $subject = "ALERT: " . $item['name'] . ($thold_show_datasource ? " [$name]" : '') . ' ' . ($ra ? 'is still' : 'went') . ' ' . ($breach_up ? 'above' : 'below') . " calculated baseline threshold " . ($breach_up ? $item['thold_hi'] : $item['thold_low']) . " with $currentval";


I don't know if this is the correct behavior since thold 0.5.0 and 0.6.0 contains the same code under the baseline re-alerts.


Thank you,
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests