Esempio n. 1
0
 def _post_alert(self, event):
     alert = AlertGenerator(event)
     alert.alert_type = ('onMaintenance' if event.state == event.STATE_START
                         else 'offMaintenance')
     alert.history_vars = dict(alert)
     if alert.is_event_duplicate():
         self._logger.info('Ignoring duplicate event')
     else:
         alert.post()
Esempio n. 2
0
    def _post_alert(self, event):
        alert = AlertGenerator(event)
        alert.alert_type = ('exceededThreshold' if event.state
                            == event.STATE_START else 'belowThreshold')

        if alert.is_event_duplicate():
            self._logger.info('Ignoring duplicate alert')
        else:
            alert.post()
Esempio n. 3
0
 def _post_alert(self, event):
     alert = AlertGenerator(event)
     alert.alert_type = (
         'onMaintenance' if event.state == event.STATE_START
         else 'offMaintenance')
     alert.history_vars = dict(alert)
     if alert.is_event_duplicate():
         self._logger.info('Ignoring duplicate event')
     else:
         alert.post()
Esempio n. 4
0
    def _post_alert(self, event):
        alert = AlertGenerator(event)
        alert.alert_type = (
            'exceededThreshold' if event.state == event.STATE_START
            else 'belowThreshold')

        if alert.is_event_duplicate():
            self._logger.info('Ignoring duplicate alert')
        else:
            alert.post()
Esempio n. 5
0
    def _post_generic_alert(self, event):
        alert = AlertGenerator(event)
        if 'alerttype' in event.varmap:
            alert.alert_type = event.varmap['alerttype']

        is_stateless = event.state == Event.STATE_STATELESS
        if is_stateless or not alert.is_event_duplicate():
            self._logger.debug('Posting %s event', event.event_type)
            alert.post()
        else:
            self._logger.info('Ignoring duplicate %s event' % event.event_type)
        event.delete()
Esempio n. 6
0
    def _post_generic_alert(self, event):
        alert = AlertGenerator(event)
        if 'alerttype' in event.varmap:
            alert.alert_type = event.varmap['alerttype']

        is_stateless = event.state == Event.STATE_STATELESS
        if is_stateless or not alert.is_event_duplicate():
            self._logger.debug('Posting %s event', event.event_type)
            alert.post()
        else:
            self._logger.info('Ignoring duplicate %s event' % event.event_type)
        event.delete()
Esempio n. 7
0
    def _post_generic_alert(self, event):
        alert = AlertGenerator(event)
        if 'alerttype' in event.varmap:
            alert.alert_type = event.varmap['alerttype']

        is_stateless = event.state == Event.STATE_STATELESS
        if is_stateless or not alert.is_event_duplicate():
            if self._box_is_on_maintenance(event):
                self._logger.debug('%s is on maintenance, only posting to '
                                   'alert history for %s event',
                                   event.netbox, event.event_type)
                alert.post_alert_history()
            else:
                self._logger.debug('Posting %s event', event.event_type)
                alert.post()
        else:
            self._logger.info('Ignoring duplicate %s event for %s',
                              event.event_type, event.netbox)
            self._logger.debug('ignored alert details: %r', event)
        event.delete()