From 76ab8146470b5b1296fa83fb726f93a653dfe97e Mon Sep 17 00:00:00 2001 From: SourceDoctor Date: Mon, 9 Nov 2020 05:15:29 +0100 Subject: [PATCH] only add new outage entry if Device status changed (#12309) * only add new outage entry if Device status changed * . --- includes/functions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 91071a6999..c239298e3d 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -2072,11 +2072,13 @@ function device_is_up($device, $record_perf = false) $type = 'down'; $reason = $response['status_reason']; - if (! $consider_maintenance || (! $maintenance && $consider_maintenance)) { - // use current time as a starting point when an outage starts - $data = ['device_id' => $device['device_id'], - 'going_down' => time(), ]; - dbInsert($data, 'device_outages'); + if ($device['status'] != $response['status']) { + if (! $consider_maintenance || (! $maintenance && $consider_maintenance)) { + // use current time as a starting point when an outage starts + $data = ['device_id' => $device['device_id'], + 'going_down' => time(), ]; + dbInsert($data, 'device_outages'); + } } }