[checkmk-commits] Check_MK Git: check_mk: logwatch: Fixed confusion with ignore/

git version control git at mathias-kettner.de
Mon Nov 19 12:23:11 CET 2012


 ok states of log messages
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Module: check_mk
Branch: master
Commit: adb19c226a7c3852a159ec64e180c620ca1cab07
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=adb19c226a7c3852a159ec64e180c620ca1cab07

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Mon Nov 19 12:23:18 2012 +0100

logwatch: Fixed confusion with ignore/ok states of log messages

---

 ChangeLog                            |    3 +++
 checks/logwatch                      |   24 ++++++------------------
 web/plugins/wato/check_parameters.py |    5 -----
 3 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d60a59..d37a685 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
     WATO:
     * Cloning of contact/host/service groups (without members)
 
+    Checks:
+    * logwatch: Fixed confusion with ignore/ok states of log messages
+
 
 1.2.1i2:
     Core:
diff --git a/checks/logwatch b/checks/logwatch
index 57e1c9a..dd94dca 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -71,7 +71,7 @@ def inventory_logwatch(info):
 # appearance.
 #
 # PATTERN is a list like:
-# [ ( 'I',      ".*ssh.*" ),          # Make informational (OK) messages from these
+# [ ( 'O',      ".*ssh.*" ),          # Make informational (OK) messages from these
 #   ( (10, 20), "login"   ),          # Warning at 10 messages, Critical at 20
 #   ( 'C',      "bad"     ),          # Always critical
 #   ( 'W',      "not entirely bad" ), # Always warning
@@ -88,15 +88,13 @@ def logwatch_state(state):
         return "OK"
 
 def logwatch_level_name(level):
-    if   level == 'I': return 'OK'
-    elif level == 'O': return 'OK'
+    if   level == 'O': return 'OK'
     elif level == 'W': return 'WARN'
     elif level == 'C': return 'CRIT'
     else: return 'IGN'
 
 def logwatch_level_worst(worst, level):
-    if   level == 'I': return max(worst, 0)
-    elif level == 'O': return max(worst, 0)
+    if   level == 'O': return max(worst, 0)
     elif level == 'W': return max(worst, 1)
     elif level == 'C': return max(worst, 2)
     else: return worst
@@ -112,17 +110,7 @@ def logwatch_precompile(hostname, item, _unused):
     rules = service_extra_conf(hostname, item, logwatch_rules)
     for rule in rules:
         for pattern in rule:
-            # The specification of "O" -> OK and "I" -> IGNORE is not equal to the.
-            # states reported by the logwatch agent. The agent sends "I" for OK messages.
-            # This is really a nastiness. We do not change the valuespec for th moment but
-            # only modify the levels taken from the defined rules.
-            # FIXME: Oneday we should clean it up. Maybe via hint in migration nodes or
-            # some mor inteligent valuespec, ...
-            if pattern[0] == 'I': # Fix "IGNORE" declaration
-                level = 'S'
-            else:
-                level = pattern[0]
-            params.append((level, pattern[1]))
+            params.append((pattern[0], pattern[1]))
 
     # Now load the old logwatch_patterns var
     patterns = logwatch_patterns.get(item)
@@ -247,7 +235,7 @@ def check_logwatch(item, params, info):
         for line in loglines:
             worst = logwatch_level_worst(worst, logwatch_parse_line(line)[0])
 
-        # Ignore log lines which result in an "S" -> "Skip / Ignore" state
+        # Ignore log lines which result in an "I" -> "Ignore" state
         if worst > -1:
             try:
                 logarch = file(logfile, "a+")
@@ -412,7 +400,7 @@ def logwatch_to_prio(level):
         return 4
     elif level == 'C':
         return 2
-    elif level == 'I':
+    elif level == '0':
         return 5
 
 def syslog_time():
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 08cbe12..030bc03 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -103,11 +103,6 @@ register_rule(group + '/' + subgroup_applications,
           elements = [
              DropdownChoice(
                title = _("State"),
-               # The specification of "O" -> OK and "I" -> IGNORE is not equal to the.
-               # states reported by the logwatch agent. The agent sends "I" for OK messages.
-               # This is really a nastiness here. Since this rule definition is already part
-               # of a released version we don't change it here, instead we clean it up in
-               # the logwatch check before applying the rules.
                choices = [
                    ('C', _('CRITICAL')),
                    ('W', _('WARNING')),



More information about the checkmk-commits mailing list