Module: check_mk
Branch: master
Commit: 50a0f6b4a428a2082691d3f804e4fc2a58b14e53
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=50a0f6b4a428a2…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Feb 15 11:05:26 2013 +0100
resolve merge conflict
---
ChangeLog | 1 +
web/htdocs/lib.py | 31 ++++++++++++++++++++++++-------
web/plugins/views/painters.py | 14 --------------
3 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dffdfac..c294a1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
WATO:
* FIX: Fixed layout of rulelist table in IE*
* FIX: Fixed adding explicit host names to rules in IE7
+ * Add: Improved navigation convenience when plugin output contains [running on ... ]
1.2.2b1:
Core:
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index a2a29c1..180c6a7 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -26,6 +26,7 @@
import grp, defaults, pprint, os, errno, gettext, marshal, fcntl, __builtin__
+
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_short_host_state_names = { 0: "UP", 1: "DOWN", 2:
"UNREACH" }
@@ -59,6 +60,7 @@ class MKInternalError(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
+
# Create directory owned by common group of Nagios and webserver,
# and make it writable for the group
def make_nagios_directory(path):
@@ -117,6 +119,7 @@ def savefloat(f):
return 0.0
+
# Load all files below share/check_mk/web/plugins/WHAT into a
# specified context (global variables). Also honors the
# local-hierarchy for OMD
@@ -216,17 +219,31 @@ warn_marker = '<b class="stmark
state1">WARN</b>'
crit_marker = '<b class="stmark state2">CRIT</b>'
unknown_marker = '<b class="stmark state3">UNKN</b>'
+def paint_host_list(site, hosts):
+ from htmllib import urlencode
+ h = ""
+ first = True
+ for host in hosts:
+ if first:
+ first = False
+ else:
+ h += ", "
+ link = "view.py?view_name=hoststatus&site=%s&host=%s" %
(urlencode(site), urlencode(host))
+ if html.var("display_options"):
+ link += "&display_options=%s" %
html.var("display_options")
+ h += "<a href=\"%s\">%s</a></div>" % (link,
host)
+ return "", h
+
def format_plugin_output(output, row = None):
output = output.replace("(!)", warn_marker) \
.replace("(!!)", crit_marker) \
.replace("(?)", unknown_marker)
- # TODO: reimplement, but considering correct paint_host_list call
- #if row and "[running on" in output:
- # a = output.index("[running on")
- # e = output.index("]", a)
- # hosts = output[a+12:e].replace(" ","").split(",")
- # css, h = paint_host_list(row["site"], hosts)
- # output = output[:a] + "running on " + h + output[e+1:]
+ if row and "[running on" in output:
+ a = output.index("[running on")
+ e = output.index("]", a)
+ hosts = output[a+12:e].replace(" ","").split(",")
+ css, h = paint_host_list(row["site"], hosts)
+ output = output[:a] + "running on " + h + output[e+1:]
return output
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index b62f294..5e5a8de 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1105,20 +1105,6 @@ multisite_painters["host_services"] = {
"paint" : lambda row: paint_service_list(row,
"host_services_with_state"),
}
-def paint_host_list(site, hosts):
- h = ""
- first = True
- for host in hosts:
- if first:
- first = False
- else:
- h += ", "
- link = "view.py?view_name=hoststatus&site=%s&host=%s" %
(htmllib.urlencode(site), htmllib.urlencode(host))
- if html.var("display_options"):
- link += "&display_options=%s" %
html.var("display_options")
- h += "<a href=\"%s\">%s</a></div>" % (link,
host)
- return "", h
-
multisite_painters["host_parents"] = {
"title" : _("Host's parents"),
"short" : _("Parents"),