Example #1
0
 static function addNotificationRule($contactId, $monitor_type, $alertGroupId, $alertRules)
 {
     $result = array();
     if ($alertGroupId > 0) {
         $info = array('contactId' => $contactId, 'monitorType' => $monitor_type, 'contactGroupId' => $alertGroupId);
         $infoSet = self::rulesFromJson($info, $alertRules);
         $resp = MonitisApi::addNotificationRule($infoSet);
         if ($resp['status'] == 'ok') {
             $result['status'] = 'ok';
             $result['msg'] = 'A notification has been successfully set';
         } else {
             $result['status'] = 'error';
             $result['msg'] = $resp['error'];
         }
     } else {
         $result['status'] = 'error';
         $result['msg'] = 'Notification is not set';
     }
     return $result;
 }