add time for statuscake

pull/352/head
Laurent RICHARD 2016-09-11 16:38:25 +02:00
parent 807f07eb46
commit 4c07c7e59d
1 changed files with 148 additions and 138 deletions

View File

@ -131,6 +131,7 @@ class StatusNotifier {
), array(
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'rtime', 'header_name', 'header_value', 'error', 'active', 'email', 'sms', 'pushover', 'statuscake','statuscake_test_id',
));
if(empty($this->server)) {
return false;
}
@ -160,17 +161,26 @@ class StatusNotifier {
}
// 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'
&& !is_null($this->server['statuscake_test_id']) && !empty($this->server['statuscake_test_id'])
) {
// yay lets wake those nerds up!
<<<<<<< HEAD
$this->notifyByStatusCake($users, $this->server['statuscake_test_id']);
}
if(!$notify) {
return false;
}
=======
$this->notifyByStatusCake($users, $this->server['statuscake_test_id'], $this->server['rtime']);
}
if(!$notify) {
return false;
}
>>>>>>> add time for statuscake
// first add to log (we use the same text as the SMS message because its short..)
if($this->save_logs) {
@ -241,11 +251,11 @@ class StatusNotifier {
}
}
protected function notifyByStatusCake($users, $statuscake_test_id) {
protected function notifyByStatusCake($users, $statuscake_test_id, $rtime) {
$statuscake = psm_build_statuscake();
$statuscake->setTestId($statuscake_test_id);
$statuscake->setTime(11);
$statuscake->setTime(($rtime*1000));
$statuscake->setStatusCode(200);
// Log