Example #1
0
 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode(urldecode($payload));
     if (!property_exists($newEvent, 'alert')) {
         return false;
     }
     $alert = $newEvent->alert;
     $event = new RawEvent();
     $event->setType('monitis');
     $system = str_replace('http://', '', $alert->url);
     $system = str_replace(' ', '', $system);
     $event->setSystem($system);
     if ($alert->alertType === self::STATUS_PROBLEM) {
         $event->setStatus(Event::STATUS_FAILURE);
         if (property_exists($alert, "errorString")) {
             $event->setMessage($alert->errorString);
         } else {
             $event->setMessage('Monitis found an error for ' . $alert->name . '.');
         }
     } else {
         $event->setStatus(Event::STATUS_SUCCESS);
         $event->setMessage("");
     }
     $event->setIdentifier("monitis_" . $system . "_" . $alert->type);
     $event->setUnique(false);
     $event->setUrl('http://dashboard.monitis.com/');
     if (property_exists($alert, 'stepDuration')) {
         $event->setValue($alert->stepDuration);
     }
     return $event;
 }
 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode($payload);
     $event = new RawEvent();
     $event->setIdentifier($newEvent->identifier);
     $event->setMessage($newEvent->message);
     $event->setStatus($newEvent->status);
     $event->setSystem($newEvent->system);
     if (property_exists($newEvent, "value")) {
         $event->setValue($newEvent->value);
     }
     if (property_exists($newEvent, "url")) {
         $event->setUrl($newEvent->url);
     } else {
         $event->setUrl("");
     }
     if (property_exists($newEvent, "type")) {
         $event->setType($newEvent->type);
     }
     return $event;
 }