diff options
author | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-10 09:39:46 +0000 |
---|---|---|
committer | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-10 09:39:46 +0000 |
commit | 09d32a855b52efcef55e33bf11a87e7ddfdb84c9 (patch) | |
tree | 4219a83444739fefc078667e4368f68e965da878 /src/extras/sos-html-logs/lib/parsers | |
parent | 453bcc1ec4ec8afc9c46eb32605b2fd8316cc4c5 (diff) | |
download | sos-09d32a855b52efcef55e33bf11a87e7ddfdb84c9.tar.gz |
developement moved to http://code.google.com/p/logpox
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@465 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/extras/sos-html-logs/lib/parsers')
5 files changed, 0 insertions, 197 deletions
diff --git a/src/extras/sos-html-logs/lib/parsers/__init__.py b/src/extras/sos-html-logs/lib/parsers/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/src/extras/sos-html-logs/lib/parsers/__init__.py +++ /dev/null diff --git a/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py b/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py deleted file mode 100644 index 3e794a6f..00000000 --- a/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py +++ /dev/null @@ -1,24 +0,0 @@ -import time -import soshtmllogs.parsers_base as parsers_base - -class crazyclock_Parser(parsers_base.base_Parser_class): - - def initialize(self): - # in this dict, we store the last date for each host - self.last_date = {} - - def parse_line(self, date, log): - - if date.date != log.date(): - self.add_event(log, "Time skew (%d seconds in the past)" % int(time.mktime(date.date) - time.mktime(log.date())), "color:purple; background-color:yellow") - - self.last_date[log.parent_host] = log.date() - - return - - def analyse_line(self, log): - - yield """The following line matched the rule:<BR>""" - yield """<DIV STYLE="margin-top: 10px; padding: 10px 10px 10px 10px; margin-bottom: 10px; background-color: white; border: 1px dotted black;">%s</B></DIV>""" % log.line - - yield "The logged time for this message is before the one for the previous message appearing in the log." diff --git a/src/extras/sos-html-logs/lib/parsers/dmapper_parser.py b/src/extras/sos-html-logs/lib/parsers/dmapper_parser.py deleted file mode 100644 index 279df50e..00000000 --- a/src/extras/sos-html-logs/lib/parsers/dmapper_parser.py +++ /dev/null @@ -1,106 +0,0 @@ -import re -import soshtmllogs.parsers_base as parsers_base - -class dmapper_Parser(parsers_base.base_Parser_class): - default_css = "color:black; background-color:orange; font-size:larger" - - def initialize(self): - self.db.execute("create table dmapper(disk PRIMARY KEY, host INTEGER, channel INTEGER, id INTEGER, lun INTEGER)") - - def parse_line(self, date, logline): - - # kernel: sd 1:0:0:49152: Attached scsi disk sdt - found = re.findall(r"""^sd (.+):(.+):(.+):(.+): Attached scsi disk (.+)$""", logline.message()) - if found: - # we can learn a little about the layout - found = found[0] - self.db.execute("""replace into dmapper(disk,host,channel,id,lun) values ("%s",%d,%d,%d,%d)""" - % (found[4], int(found[0]), int(found[1]), int(found[2]), int(found[3])) - ) - - found = re.findall(r"""^Attached scsi disk (.+) at scsi(.+), channel (.+), id (.+), lun (.+)$""", logline.message()) - if found: - # we can learn a little about the layout - found = found[0] - self.db.execute("""replace into dmapper(disk,host,channel,id,lun) values ("%s",%d,%d,%d,%d)""" - % (found[0], int(found[1]), int(found[2]), int(found[3]), int(found[4])) - ) - - #Nov 7 12:55:38 itrac415 kernel: SCSI error : <2 0 3 0> return code = 0x20000 - found = re.findall(r"""^SCSI error : <(.+)> return code = (.+)$""", logline.message()) - if found: - found = found[0] - scsi_address_split = [ int(sid) for sid in found[0].split(" ") ] - results = self.db.execute_and_fetch("select disk from dmapper where host = %d AND channel = %d AND id = %d AND lun = %d" % - (scsi_address_split[0], scsi_address_split[1], scsi_address_split[2], scsi_address_split[3]) - ) - for row in results: found[0] = row["disk"] - self.add_event(logline, "SCSI error on %s - %s" % (found[0], self._get_did_error(found[1])), self.default_css) - return - - found = re.findall(r"""^end_request: I/O error, dev (.*), sector .*$""", logline.message()) - if found: - self.add_event(logline, "I/O error on %s" % (found[0]), self.default_css) - return - - if logline.daemon() != "multipathd": - return - - found = re.findall(r"""(.*): mark as failed$""", logline.message()) - if found: - disk = self._get_disk_from_majmin(found[0]) - self.add_event(logline, "Multipath path %s (%s) failed" % (found[0], disk), self.default_css) - return - - found = re.findall(r"""(.*): reinstated$""", logline.message()) - if found: - disk = self._get_disk_from_majmin(found[0]) - self.add_event(logline, "Multipath path %s (%s) reinstated" % (found[0], disk), self.default_css) - return - - return - - def _get_disk_from_majmin(self, majmin): - major, minor = majmin.split(":") - major, minor = int(major), int(minor) - - block_majors = [8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135] - - disk = (block_majors.index(major) * 16) + int(minor / 16) - partition = minor % 16 - - # 97 = ord('a') - # 25 = ord('z') - ord('a') - - rchar = chr(97 + (disk % 25)) - - if disk > 25: - lchar = chr(97 - 1 + int(disk / 25)) - rchar = chr(ord(rchar)-1) - else: - lchar = "" - - return "sd" + lchar + rchar - - def _get_did_error(self, hexerr): - # hexherr = 0x20000 - - if not hexerr.startswith("0x"): - return "Unknown error code (%s)" % hexerr - - err = hexerr[2] - - if err == "0": return "DID_OK (NO error)" - if err == "1": return "DID_NO_CONNECT (Couldn\\'t connect before timeout period)" - if err == "2": return "DID_BUS_BUSY (BUS stayed busy through time out period)" - if err == "3": return "DID_TIME_OUT (TIMED OUT for other reason)" - if err == "4": return "DID_BAD_TARGET (BAD target)" - if err == "5": return "DID_ABORT (Told to abort for some other reason)" - if err == "6": return "DID_PARITY (Parity error)" - if err == "7": return "DID_ERROR (Internal error)" - if err == "8": return "DID_RESET (Reset by somebody)" - if err == "9": return "DID_BAD_INTR (Got an interrupt we weren't expecting)" - if err == "a": return "DID_PASSTHROUGH (Force command past mid-layer)" - if err == "b": return "DID_SOFT_ERROR (The low level driver just wish a retry)" - if err == "c": return "DID_IMM_RETRY (Retry without decrementing retry count)" - if err == "d": return "DID_REQUEUE (Requeue command (no immediate retry) also without decrementing the retry count)" diff --git a/src/extras/sos-html-logs/lib/parsers/simple_parser.py b/src/extras/sos-html-logs/lib/parsers/simple_parser.py deleted file mode 100644 index 9beb10f8..00000000 --- a/src/extras/sos-html-logs/lib/parsers/simple_parser.py +++ /dev/null @@ -1,29 +0,0 @@ -import ConfigParser, re -import soshtmllogs.parsers_base as parsers_base - -class simple_Parser(parsers_base.base_Parser_class): - - def initialize(self): - self.config = ConfigParser.ConfigParser() - self.config.readfp(open('/usr/lib/python2.4/site-packages/soshtmllogs/parsers/simple_parser.rules')) - - def parse_line(self, date, log): - - for section in self.config.sections(): - match = False - - if self.config.has_option(section, "find"): - if log.line.find(self.config.get(section, "find")) >= 0: - match = True - elif self.config.has_option(section, "regex"): - if re.match(self.config.get(section, "regex"), log.line): - match = True - - if not match: - continue - - self.add_event(log, section, "color:green; background-color:yellow; font-size:larger") - - return - - return None diff --git a/src/extras/sos-html-logs/lib/parsers/simple_parser.rules b/src/extras/sos-html-logs/lib/parsers/simple_parser.rules deleted file mode 100644 index 724fbfa8..00000000 --- a/src/extras/sos-html-logs/lib/parsers/simple_parser.rules +++ /dev/null @@ -1,38 +0,0 @@ -[Syslog restart (possible system restart)] -regex = .*syslogd .*: restart.$ - -[System reboot] -regex = ^kernel: Linux version - -[Fencing node] -regex = ^.*fencing node - -[Fencing node succeeded] -regex = .*fence ".*" success - -[Fencing node failed] -regex = .*fence ".* - -[Quorum lost] -find = quorum lost, blocking activity - -[Quorum regained] -find = quorum regained, resuming activity - -[Segmentation fault] -find = segfault at - -[Inittab reloaded] -find = Re-reading inittab - -[Init line respawning too fast] -find = respawning too fast: disabled for - -[Ext3 file-system error] -find = EXT3-fs error - -[File-system remounted read-only] -find = Remounting filesystem read-only - -[Shutting down] -find = shutdown: shutting down |