Skip to content

Commit

Permalink
only add new outage entry if Device status changed (#12309)
Browse files Browse the repository at this point in the history
* only add new outage entry if Device status changed

* .
  • Loading branch information
SourceDoctor committed Nov 9, 2020
1 parent 2b5da1e commit 76ab814
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions includes/functions.php
Expand Up @@ -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');
}
}
}

Expand Down

0 comments on commit 76ab814

Please sign in to comment.