Skip to content

Commit

Permalink
QA on #4989
Browse files Browse the repository at this point in the history
Add device caching options for changing state
  • Loading branch information
TheWitness committed Nov 20, 2022
1 parent 17495a4 commit ef85619
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,8 @@ function update_host_status($status, $host_id, &$ping, $ping_availability, $prin
if ($host['status_event_count'] == $ping_failure_count) {
$host['status_fail_date'] = time();
}

set_config_option('time_last_change_site_device', time());
/* host is down, but not ready to issue log message */
} else {
/* host down for the first time, set event date */
Expand All @@ -1638,10 +1640,13 @@ function update_host_status($status, $host_id, &$ping, $ping_availability, $prin
$host['status_event_count'] = 1;
$host['status'] = HOST_DOWN;

set_config_option('time_last_change_site_device', time());
/* host was unknown and now is down */
} elseif ($host['status'] == HOST_UNKNOWN) {
$host['status'] = HOST_DOWN;
$host['status_event_count'] = 0;

set_config_option('time_last_change_site_device', time());
} else {
$host['status_event_count']++;
}
Expand Down Expand Up @@ -1715,6 +1720,8 @@ function update_host_status($status, $host_id, &$ping, $ping_availability, $prin
$host['status_event_count']++;
}

set_config_option('time_last_change_site_device', time());

/* if it's time to issue a recovery message, indicate so */
if ($host['status_event_count'] >= $ping_recovery_count) {
/* host is up, flag it that way */
Expand All @@ -1740,6 +1747,8 @@ function update_host_status($status, $host_id, &$ping, $ping_availability, $prin
/* host was unknown and now is up */
$host['status'] = HOST_UP;
$host['status_event_count'] = 0;

set_config_option('time_last_change_site_device', time());
}
}
/* if the user wants a flood of information then flood them */
Expand Down

0 comments on commit ef85619

Please sign in to comment.