(self, line)
Actual nagios parsing
        Return True if we found an event, False otherwise
Actual nagios parsing
        Return True if we found an event, False otherwise
Actual nagios parsing Return True if we found an event False otherwise
def parse_line(self, line):
        """
        Actual nagios parsing
        Return True if we found an event, False otherwise
        """
        # first isolate the timestamp and the event type
        try:
            m = RE_LINE_REG.match(line)
            if m is None:
                m = RE_LINE_EXT.match(line)
            if m is None:
                return False
            self.log.debug("Matching line found %s", line)
            tstamp, event_type, remainder = m.groups()
            tstamp = int(tstamp)

            # skip passive checks reports by default for spamminess
            if event_type == 'PASSIVE SERVICE CHECK' and not self._passive_checks:
                return False
            # then retrieve the event format for each specific event type
            fields = EVENT_FIELDS.get(event_type)
            if fields is None:
                self.log.warning("Ignoring unknown nagios event for line: %s", (line[:-1]))
                return False
            if not fields:
                # Ignore and skip
                self.log.debug("Ignoring Nagios event for line: %s", (line[:-1]))
                return False

            # and parse the rest of the line
            parts = [p.strip() for p in remainder.split(';')]
            # Chop parts we don't recognize
            parts = parts[: len(fields._fields)]

            event = self.create_event(tstamp, event_type, self.hostname, fields._make(parts), tags=self._tags)

            self._event(event)
            self.log.debug("Nagios event: %s", event)

            return True
        except Exception:
            self.log.exception("Unable to create a nagios event from line: [%s]", line)
            return False
def parse_line ( self , line ) : # first isolate the timestamp and the event type try : m = RE_LINE_REG . match ( line ) if m is None : m = RE_LINE_EXT . match ( line ) if m is None : return False self . log . debug ( "Matching line found %s" , line ) tstamp , event_type , remainder = m . groups ( ) tstamp = int ( tstamp ) # skip passive checks reports by default for spamminess if event_type == 'PASSIVE SERVICE CHECK' and not self . _passive_checks : return False # then retrieve the event format for each specific event type fields = EVENT_FIELDS . get ( event_type ) if fields is None : self . log . warning ( "Ignoring unknown nagios event for line: %s" , ( line [ : - 1 ] ) ) return False if not fields : # Ignore and skip self . log . debug ( "Ignoring Nagios event for line: %s" , ( line [ : - 1 ] ) ) return False # and parse the rest of the line parts = [ p . strip ( ) for p in remainder . split ( ';' ) ] # Chop parts we don't recognize parts = parts [ : len ( fields . _fields ) ] event = self . create_event ( tstamp , event_type , self . hostname , fields . _make ( parts ) , tags = self . _tags ) self . _event ( event ) self . log . debug ( "Nagios event: %s" , event ) return True except Exception : self . log . exception ( "Unable to create a nagios event from line: [%s]" , line ) return False