Exemplo n.º 1
0
    def pre_receive(self, alert, **kwargs):
        HEARTBEAT_EVENTS = self.get_config('HEARTBEAT_EVENTS',
                                           default=['Heartbeat'],
                                           type=list,
                                           **kwargs)

        if alert.event in HEARTBEAT_EVENTS:
            if 'timeout' in request.json:
                timeout = alert.timeout
            else:
                timeout = current_app.config['HEARTBEAT_TIMEOUT']

            hb = Heartbeat(origin=alert.origin,
                           tags=alert.tags,
                           attributes={
                               'environment': alert.environment,
                               'severity': alert.severity,
                               'service': alert.service,
                               'group': alert.group
                           },
                           timeout=timeout,
                           customer=alert.customer)
            r = hb.create()
            raise HeartbeatReceived(r.id)

        return alert
Exemplo n.º 2
0
    def pre_receive(self, alert):

        if alert.event == 'Heartbeat':
            hb = Heartbeat(origin=alert.origin,
                           tags=alert.tags,
                           timeout=alert.timeout,
                           customer=alert.customer)
            hb.create()
            raise HeartbeatReceived('Alert converted to heartbeat')

        return alert
Exemplo n.º 3
0
    def pre_receive(self, alert, **kwargs):

        if alert.event == 'Heartbeat':
            hb = Heartbeat(origin=alert.origin,
                           tags=alert.tags,
                           timeout=alert.timeout,
                           customer=alert.customer)
            r = hb.create()
            raise HeartbeatReceived(r.id)

        return alert
Exemplo n.º 4
0
    def pre_receive(self, alert, **kwargs):
        HEARTBEAT_EVENTS = self.get_config('HEARTBEAT_EVENTS',
                                           default=['Heartbeat'],
                                           type=list,
                                           **kwargs)

        if alert.event in HEARTBEAT_EVENTS:
            hb = Heartbeat(origin=alert.origin,
                           tags=alert.tags,
                           timeout=alert.timeout,
                           customer=alert.customer)
            r = hb.create()
            raise HeartbeatReceived(r.id)

        return alert