Module: check_mk
Branch: master
Commit: 5ffb06cf45213d28c728719397f7afb34aa9aa1e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5ffb06cf45213d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 16 11:34:45 2013 +0200
Multisite: fix state column in log view if state is invalid
---
web/htdocs/lib.py | 4 ++--
web/plugins/views/painters.py | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index f37ba2e..ce752f8 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -33,8 +33,8 @@ except:
pass
-nagios_state_names = { -1: "NODATA", 0: "OK", 1: "WARNING",
2: "CRITICAL", 3: "UNKNOWN", 4: "DEPENDENT" }
-nagios_short_state_names = { -1: "PEND", 0: "OK", 1:
"WARN", 2: "CRIT", 3: "UNKN", 4: "DEP" }
+nagios_state_names = { -1: "NODATA", 0: "OK", 1: "WARNING",
2: "CRITICAL", 3: "UNKNOWN" }
+nagios_short_state_names = { -1: "PEND", 0: "OK", 1:
"WARN", 2: "CRIT", 3: "UNKN" }
nagios_short_host_state_names = { 0: "UP", 1: "DOWN", 2:
"UNREACH" }
class MKGeneralException(Exception):
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 02614f0..5cc842c 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -281,7 +281,7 @@ multisite_painters["sitealias"] = {
def paint_service_state_short(row):
if row["service_has_been_checked"] == 1:
state = str(row["service_state"])
- name = nagios_short_state_names[row["service_state"]]
+ name = nagios_short_state_names.get(row["service_state"],
"")
else:
state = "p"
name = "PEND"
@@ -293,7 +293,9 @@ def paint_host_state_short(row):
# return None, str(row)
if row["host_has_been_checked"] == 1:
state = row["host_state"]
- name = nagios_short_host_state_names[row["host_state"]]
+ # A state of 3 is sent by livestatus in cases where no normal state
+ # information is avaiable, e.g. for "DOWNTIMESTOPPED (UP)"
+ name = nagios_short_host_state_names.get(row["host_state"],
"")
else:
state = "p"
name = "PEND"