def _resolver(count): 
     msgs = []
     for alert in incident['details']:
         msgs.append(alert.summary())
 
     data = json.dumps({ 'service_key': self._service_api_key, 'incident_key': incident['incident_key'], 
                 'event_type':'resolve', 'description':'RESOLVED! ' + incident['description'], 'details': msgs })
     resp = http_post('https://events.pagerduty.com/generic/2010-04-15/create_event.json', body=data, **self._http_base_params())
     self._info("resolved incident: {0} on try #{2} resp: {1}".format(incident['incident_key'], resp, count+1))
     self._summary['resolved_api'] += 1
Beispiel #2
0
        def _reporter(count):
            msgs = []
            for alert in incident['details']:
                msgs.append(alert.summary())

            data = json.dumps({
                'service_key': self._service_api_key,
                'incident_key': incident['incident_key'],
                'event_type': 'trigger',
                'description': incident['description'],
                'details': msgs
            })
            resp = http_post(
                'https://events.pagerduty.com/generic/2010-04-15/create_event.json',
                body=data,
                **self._http_base_params())
            self._info("reported incident: {0} on try #{2} resp: {1}".format(
                incident['incident_key'], resp, count + 1))
            self._summary['incidents_triggered'] += 1

            incident['reported'] = True
Beispiel #3
0
 def post_to_callback(self, body):
     response = http_post(self.webhook, body)
     if str(response.status_code)[0] != "2":
         raise IOError, "Return status %s" % response.status_code
     if len(response.content) > 0:
         raise ValueError, "Returned content, is defined illegal"
Beispiel #4
0
 def post_to_callback(self, body):
     response = http_post(self.webhook, body)
     if str(response.status_code)[0] != "2":
         raise IOError("Return status %s" % response.status_code)
     if len(response.content) > 0:
         raise ValueError("Returned content, is defined illegal")