issue #59: Warning threshold ignored for notification trigger
parent
1da008b3b4
commit
6655f990b0
|
@ -5,8 +5,9 @@ not yet released
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
* #57: Added Chinese translation.
|
* #57: Added Chinese translation.
|
||||||
* Sphinx is now used for documentation <http://sphinx.pocoo.org/>.
|
|
||||||
* #58: Server order on users page now matches the order on servers page.
|
* #58: Server order on users page now matches the order on servers page.
|
||||||
|
* #59: Warning threshold ignored for notification trigger.
|
||||||
|
* Sphinx is now used for documentation <http://sphinx.pocoo.org/>.
|
||||||
|
|
||||||
|
|
||||||
v3.0.0 (released April 6, 2014)
|
v3.0.0 (released April 6, 2014)
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Autorun {
|
||||||
// notify the nerds if applicable
|
// notify the nerds if applicable
|
||||||
$notifier->notify($server['server_id'], $status_old, $status_new);
|
$notifier->notify($server['server_id'], $status_old, $status_new);
|
||||||
|
|
||||||
// clean-up time!! archive all records older than 1 month
|
// clean-up time!! archive all records older than 1 week
|
||||||
$archiver->archive($server['server_id'], $cleanup_date);
|
$archiver->archive($server['server_id'], $cleanup_date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@ class StatusUpdater {
|
||||||
* The function its all about. This one checks whether the given ip and port are up and running!
|
* The function its all about. This one checks whether the given ip and port are up and running!
|
||||||
* If the server check fails it will try one more time, depending on the $max_runs.
|
* If the server check fails it will try one more time, depending on the $max_runs.
|
||||||
*
|
*
|
||||||
|
* Please note: if the server is down but has not met the warning threshold, this will return true
|
||||||
|
* to avoid any "we are down" events.
|
||||||
* @param int $server_id
|
* @param int $server_id
|
||||||
* @param int $max_runs how many times should the script recheck the server if unavailable. default is 2
|
* @param int $max_runs how many times should the script recheck the server if unavailable. default is 2
|
||||||
* @return boolean TRUE if server is up, FALSE otherwise
|
* @return boolean TRUE if server is up, FALSE otherwise
|
||||||
|
@ -102,6 +104,10 @@ class StatusUpdater {
|
||||||
'rtime' => $this->rtime,
|
'rtime' => $this->rtime,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// log the uptime before checking the warning threshold,
|
||||||
|
// so that the warnings can still be reviewed in the server history.
|
||||||
|
psm_log_uptime($this->server_id, (int) $this->status_new, $this->rtime);
|
||||||
|
|
||||||
if($this->status_new == true) {
|
if($this->status_new == true) {
|
||||||
// if the server is on, add the last_online value and reset the error threshold counter
|
// if the server is on, add the last_online value and reset the error threshold counter
|
||||||
$save['status'] = 'on';
|
$save['status'] = 'on';
|
||||||
|
@ -115,13 +121,13 @@ class StatusUpdater {
|
||||||
// the server is offline but the error threshold has not been met yet.
|
// the server is offline but the error threshold has not been met yet.
|
||||||
// so we are going to leave the status "on" for now while we are in a sort of warning state..
|
// so we are going to leave the status "on" for now while we are in a sort of warning state..
|
||||||
$save['status'] = 'on';
|
$save['status'] = 'on';
|
||||||
|
$this->status_new = true;
|
||||||
} else {
|
} else {
|
||||||
$save['status'] = 'off';
|
$save['status'] = 'off';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->save(PSM_DB_PREFIX . 'servers', $save, array('server_id' => $this->server_id));
|
$this->db->save(PSM_DB_PREFIX . 'servers', $save, array('server_id' => $this->server_id));
|
||||||
psm_log_uptime($this->server_id, (int) $this->status_new, $this->rtime);
|
|
||||||
|
|
||||||
return $this->status_new;
|
return $this->status_new;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue