only add new outage entry if Device status changed (#12309)

* only add new outage entry if Device status changed

* .
This commit is contained in:
SourceDoctor
2020-11-08 22:15:29 -06:00
committed by GitHub
parent 2b5da1ef05
commit 76ab814647
+7 -5
View File
@@ -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');
}
}
}