예제 #1
0
 def pre_receive(self, alert):
     if alert.is_blackout():
         if app.config.get('NOTIFICATION_BLACKOUT', False):
             alert.attributes['notify'] = False
         else:
             raise BlackoutPeriod("Suppressed alert during blackout period")
     return alert
예제 #2
0
    def pre_receive(self, alert, **kwargs):
        NOTIFICATION_BLACKOUT = self.get_config('NOTIFICATION_BLACKOUT', default=True, type=bool, **kwargs)

        if alert.is_blackout():
            if NOTIFICATION_BLACKOUT:
                alert.status = 'blackout'
            else:
                raise BlackoutPeriod('Suppressed alert during blackout period')
        return alert
예제 #3
0
파일: blackout.py 프로젝트: yijxiang/alerta
    def pre_receive(self, alert):

        if alert.is_blackout():
            if NOTIFICATION_BLACKOUT:
                LOG.debug('Set status to "blackout" during blackout period (id=%s)' % alert.id)
                alert.status = 'blackout'
            else:
                LOG.debug('Suppressed alert during blackout period (id=%s)' % alert.id)
                raise BlackoutPeriod('Suppressed alert during blackout period')
        return alert
예제 #4
0
파일: blackout.py 프로젝트: bhyvex/alerta
    def pre_receive(self, alert):

        is_blackout = alert.is_blackout()
        do_not_notify = app.config.get('NOTIFICATION_BLACKOUT', False)

        if do_not_notify and is_blackout:
            alert.attributes['notify'] = False
        elif do_not_notify and not is_blackout:
            alert.attributes['notify'] = True
        elif not do_not_notify and is_blackout:
            raise BlackoutPeriod("Suppressed alert during blackout period")
        return alert
예제 #5
0
    def pre_receive(self, alert):

        if app.config['ALARM_MODEL'] == 'ALERTA':
            status = 'blackout'
        else:
            status = 'OOSRV'  # ISA_18_2

        if alert.is_blackout():
            if NOTIFICATION_BLACKOUT:
                LOG.debug('Set status to "{}" during blackout period (id={})'.format(status, alert.id))
                alert.status = status
            else:
                LOG.debug('Suppressed alert during blackout period (id={})'.format(alert.id))
                raise BlackoutPeriod('Suppressed alert during blackout period')
        return alert
예제 #6
0
파일: blackout.py 프로젝트: raddessi/alerta
    def pre_receive(self, alert, **kwargs):
        NOTIFICATION_BLACKOUT = self.get_config('NOTIFICATION_BLACKOUT', default=True, type=bool, **kwargs)

        if self.get_config('ALARM_MODEL', **kwargs) == 'ALERTA':
            status = 'blackout'
        else:
            status = 'OOSRV'  # ISA_18_2

        if alert.is_blackout():
            if NOTIFICATION_BLACKOUT:
                LOG.debug(f'Set status to "{status}" during blackout period (id={alert.id})')
                alert.status = status
            else:
                LOG.debug(f'Suppressed alert during blackout period (id={alert.id})')
                raise BlackoutPeriod('Suppressed alert during blackout period')
        return alert
예제 #7
0
 def pre_receive(self, alert):
     if alert.is_blackout():
         raise BlackoutPeriod('Suppressed alert during blackout period')
     return alert