From 43daa9b0c3e18042be76ac46ecd9e3e076dcb068 Mon Sep 17 00:00:00 2001 From: Sean Mancini Date: Sun, 16 Aug 2026 22:41:58 -0400 Subject: [PATCH 1/2] for for 750 --- thold_functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thold_functions.php b/thold_functions.php index a3bab97..9b2e90e 100644 --- a/thold_functions.php +++ b/thold_functions.php @@ -3390,7 +3390,7 @@ function thold_check_threshold(&$thold_data) { 'host_id' => $thold_data['host_id'], 'local_graph_id' => $thold_data['local_graph_id'], 'threshold_id' => $thold_data['id'], - 'threshold_value' => ($breach_up ? $thold_data['time_hi'] : $thold_data['time_low']), + 'threshold_value' => ($warning_breach_up ? $thold_data['time_warning_hi'] : $thold_data['time_warning_low']), 'current' => $thold_data['lastread'], 'status' => ($ra ? ST_NOTIFYRAW : ST_NOTIFYWA), 'description' => ($maint_dev ? $subject . '. ' . __('Only logging, maint device', 'thold') : $subject), @@ -3406,7 +3406,7 @@ function thold_check_threshold(&$thold_data) { 'host_id' => $thold_data['host_id'], 'local_graph_id' => $thold_data['local_graph_id'], 'threshold_id' => $thold_data['id'], - 'threshold_value' => ($warning_breach_up ? $thold_data['time_hi'] : $thold_data['time_low']), + 'threshold_value' => ($warning_breach_up ? $thold_data['time_warning_hi'] : $thold_data['time_warning_low']), 'current' => $thold_data['lastread'], 'status' => ST_NOTIFYRAW, 'description' => ($maint_dev ? $subject . '. ' . __('Only logging, maint device', 'thold') : $subject), @@ -3420,7 +3420,7 @@ function thold_check_threshold(&$thold_data) { 'host_id' => $thold_data['host_id'], 'local_graph_id' => $thold_data['local_graph_id'], 'threshold_id' => $thold_data['id'], - 'threshold_value' => ($warning_breach_up ? $thold_data['time_hi'] : $thold_data['time_low']), + 'threshold_value' => ($warning_breach_up ? $thold_data['time_warning_hi'] : $thold_data['time_warning_low']), 'current' => $thold_data['lastread'], 'status' => ST_TRIGGERW, 'description' => ($maint_dev ? $subject . '. ' . __('Only logging, maint device', 'thold') : $subject), From f7edb84e80d97135d3ccf210f454f876b572935f Mon Sep 17 00:00:00 2001 From: Sean Mancini Date: Sun, 16 Aug 2026 22:56:03 -0400 Subject: [PATCH 2/2] Fix #746: Correct inverted type 2 normal restoral conditions The type 2 (time-based) restoral logic in thold_check_threshold() used '<' instead of '>=' for the fail count comparisons: - Warning restoral: $warning_failures < $warning_trigger - Alert restoral: $failures < $trigger This inversion caused restorals to fire for thresholds that were never triggered (count below trigger), while silently suppressing restorals for thresholds that were actually triggered (count at or above trigger). Changed '<' to '>=' for both comparisons, matching the correct pattern used in the type 0 restoral logic which checks: $thold_data['thold_warning_fail_count'] >= $warning_trigger --- thold_functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thold_functions.php b/thold_functions.php index 9b2e90e..8e2cff9 100644 --- a/thold_functions.php +++ b/thold_functions.php @@ -3440,7 +3440,7 @@ function thold_check_threshold(&$thold_data) { $subject = get_email_subject('NORMAL', false, $lastread, false, false, $thold_data); - if ($alertstat != 0 && $warning_failures < $warning_trigger && $thold_data['restored_alert'] != 'on') { + if ($alertstat != 0 && $warning_failures >= $warning_trigger && $thold_data['restored_alert'] != 'on') { if (!$maint_dev) { if ($syslog) { logger($subject, $url, $syslog_priority, $syslog_facility); @@ -3509,7 +3509,7 @@ function thold_check_threshold(&$thold_data) { WHERE id = ?', [$thold_data['id']]); } - } elseif ($alertstat != 0 && $failures < $trigger && $thold_data['restored_alert'] != 'on') { + } elseif ($alertstat != 0 && $failures >= $trigger && $thold_data['restored_alert'] != 'on') { $subject = get_email_subject('NORMAL', false, $lastread, false, false, $thold_data); if (!$maint_dev) {