public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode($payload);
     $issue = $newEvent->issue;
     $message = $issue->fields->summary;
     $project = $issue->fields->project->key;
     $jiraStatus = $issue->fields->status->name;
     $identifier = "jira_" . $issue->key;
     if (in_array($jiraStatus, $this->successStates)) {
         $status = Event::STATUS_SUCCESS;
     } else {
         $status = Event::STATUS_FAILURE;
     }
     $event = new RawEvent();
     $event->setIdentifier($identifier);
     $event->setMessage($message);
     $event->setSystem($project);
     $event->setStatus($status);
     $parts = parse_url($issue->self);
     $url = $parts["scheme"] . "://" . $parts["host"] . "/browse/" . $newEvent->issue->key;
     $event->setUrl($url);
     $event->setUnique(true);
     $event->setType("jira");
     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;
 }
 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode($payload);
     if ($newEvent->current_state == self::STATUS_SUCCESS) {
         $status = Event::STATUS_FAILURE;
     } else {
         $status = Event::STATUS_SUCCESS;
     }
     $event = new RawEvent();
     $event->setStatus($status);
     $event->setIdentifier("newrelic_" . $newEvent->policy_name . "_" . $this->translate($newEvent->targets[0]->name));
     $event->setMessage($newEvent->details);
     $event->setSystem($this->translate($newEvent->targets[0]->name));
     $event->setUrl($newEvent->incident_url);
     $event->setType("newrelic");
     $event->setUnique(true);
     return $event;
 }
Beispiel #4
0
 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode($payload);
     $event = new RawEvent();
     if ($newEvent->build->phase != self::PHASE_COMPLETED) {
         return false;
     }
     if ($newEvent->build->status == self::STATUS_SUCCESS) {
         $status = Event::STATUS_SUCCESS;
         $message = "";
     } else {
         $status = Event::STATUS_FAILURE;
         $message = "Jenkins \"" . $newEvent->name . "\" failed";
     }
     $event->setMessage($message);
     $event->setStatus($status);
     $event->setSystem($newEvent->name);
     $event->setIdentifier($newEvent->name);
     $event->setUrl($newEvent->build->full_url);
     $event->setType($event->getIdentifier());
     return $event;
 }
Beispiel #5
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)
 {
     // @todo not sure if the clean process is needed anymore
     $cleanPayload = preg_replace("^\${(.*)}^", '""', $payload);
     $newEvent = json_decode($cleanPayload);
     $event = new RawEvent();
     $identifier = "appDynamics_" . $newEvent->event->application->id . '_';
     // appD . application . healthrule
     if ($newEvent->event->healthRuleEvent == "true") {
         $identifier .= $newEvent->event->healthRule->id;
         $event->setUnique(false);
     } else {
         $identifier .= $newEvent->event->incident->id;
         $event->setUnique(true);
     }
     $event->setIdentifier($identifier);
     $event->setMessage($newEvent->event->summaryMessage);
     if (in_array($newEvent->event->eventType, $this->successStatus)) {
         $event->setStatus(Event::STATUS_SUCCESS);
     } else {
         $event->setStatus(Event::STATUS_FAILURE);
     }
     $event->setSystem($this->translate($newEvent->event->application->name));
     $event->setType("AppDynamics");
     $event->setUrl($newEvent->event->deepLink);
     return $event;
 }