add time for statuscake

pull/352/head^2
Laurent RICHARD 2016-09-11 16:38:25 +02:00
parent 62b081db57
commit 0f8edf971d
1 changed files with 6 additions and 6 deletions

View File

@ -129,7 +129,7 @@ class StatusNotifier {
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array( $this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
'server_id' => $server_id, 'server_id' => $server_id,
), array( ), array(
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', 'statuscake','statuscake_test_id', 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'rtime', 'error', 'active', 'email', 'sms', 'pushover', 'statuscake','statuscake_test_id',
)); ));
if(empty($this->server)) { if(empty($this->server)) {
return false; return false;
@ -160,14 +160,14 @@ class StatusNotifier {
} }
// check if statuscake is enabled for this server // check if statuscake is enabled for this server
if( !is_null($this->send_statuscake_account_token) && !empty($this->send_statuscake_account_token) if( $this->server['status'] == 'on' && !is_null($this->send_statuscake_account_token) && !empty($this->send_statuscake_account_token)
&& $this->server['statuscake'] == 'yes' && $this->server['statuscake'] == 'yes'
&& !is_null($this->server['statuscake_test_id']) && !empty($this->server['statuscake_test_id']) && !is_null($this->server['statuscake_test_id']) && !empty($this->server['statuscake_test_id'])
) { ) {
// yay lets wake those nerds up! // yay lets wake those nerds up!
$this->notifyByStatusCake($users, $this->server['statuscake_test_id']); $this->notifyByStatusCake($users, $this->server['statuscake_test_id'], $this->server['rtime']);
} }
if(!$notify) { if(!$notify) {
return false; return false;
} }
@ -241,11 +241,11 @@ class StatusNotifier {
} }
} }
protected function notifyByStatusCake($users, $statuscake_test_id) { protected function notifyByStatusCake($users, $statuscake_test_id, $rtime) {
$statuscake = psm_build_statuscake(); $statuscake = psm_build_statuscake();
$statuscake->setTestId($statuscake_test_id); $statuscake->setTestId($statuscake_test_id);
$statuscake->setTime(11); $statuscake->setTime(($rtime*1000));
$statuscake->setStatusCode(200); $statuscake->setStatusCode(200);
// Log // Log