Module: check_mk
Branch: master
Commit: 69a3042d25feddaaad80081048b83073e47db7e8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=69a3042d25fedd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 29 14:09:42 2013 +0200
Fixed styling of staleness
---
web/htdocs/images/icon_stale.png | Bin 2588 -> 4526 bytes
web/htdocs/status.css | 42 ++++++++++++--------------------------
web/htdocs/views.py | 13 ++++++------
web/plugins/icons/builtin.py | 1 +
web/plugins/views/painters.py | 17 ++++++++-------
web/plugins/views/perfometer.py | 8 ++++++--
6 files changed, 37 insertions(+), 44 deletions(-)
diff --git a/web/htdocs/images/icon_stale.png b/web/htdocs/images/icon_stale.png
index 75238fa..f083b05 100644
Binary files a/web/htdocs/images/icon_stale.png and b/web/htdocs/images/icon_stale.png
differ
diff --git a/web/htdocs/status.css b/web/htdocs/status.css
index 83233f2..6fe4b2b 100644
--- a/web/htdocs/status.css
+++ b/web/htdocs/status.css
@@ -43,15 +43,24 @@ td.state {
width: 32px;
}
+td.svcstate.stale {
+ background-image: url("images/white_60percent.png");
+ background-repeat: repeat;
+}
+
+table.data tr.data td.stale,
+table.data td.perfometer.stale div.title {
+ color: #888;
+ text-shadow: 0.8px 0.8px 0.8px #fff;
+}
+
+
+
/* OK/UP */
.state0, .hstate0, .state0 a, .hstate0 a {
background-color: #0b3; color: #fff;
}
-.state0.stale, .hstate0.stale, .state0.stale a, .hstate0.stale a {
- background-color: #9FDDB0; color: #fff;
-}
-
.hstate {
white-space: nowrap;
}
@@ -60,46 +69,26 @@ td.state {
background-color: #ff0; color: #000;
}
-.state1.stale, .state1.stale a, tr.groupheader td.state1.stale {
- background-color: #FFFFCE; color: #BCBCBC;
-}
-
/* CRIT/DOWN */
.state2, .hstate1, .state2 a, .hstate2 a {
background-color: #f00; color: #fff;
}
-.state2.stale, .hstate1.stale, .state2.stale a, .hstate2.stale a {
- background-color: #FFBFBF; color: #fff;
-}
-
/* UNKNOWN / UNREACH */
.state3, .hstate2, .state3 a, .hstate2 a {
background-color: #f80; color: #fff;
}
-.state3.stale, .hstate2.stale, .state3.stale a, .hstate2.stale a {
- background-color: #FFE1BF; color: #fff;
-}
-
/* PENDING */
.statep, .hstatep, .statep a, .hstatep a {
background-color: #888; color: #fff;
}
-.statep.stale, .hstatep.stale, .statep.stale a, .hstatep.stale a {
- background-color: #D6D6D6; color: #fff;
-}
-
/* in DOWNTIME */
.stated, .hstated, .stated a, .hstated a {
background-color: #0af; color: #fff;
}
-.stated.stale, .hstated.stale, .stated.stale a, .hstated.stale a {
- background-color: #CCEEFF; color: #fff;
-}
-
/* inline state markers in check output */
b.stmark {
margin-left: 4px;
@@ -241,7 +230,6 @@ td.statex { /* zero count */
/* Row coloring in case of the different states */
tr.odd0 { background-color: #eee; }
-tr.odd0 td.stale { background-color: #f4f4f4; }
tr.even0 { background-color: #ddd; }
td.odd0 { background-color: #eee; }
@@ -331,10 +319,6 @@ table.data td.center {
text-align: center;
}
-table.data tr .stale, table.data tr .stale a, table.data tr .stale td.age {
- color: #b7b7b7;
-}
-
td.narrow {
width: 10px;
}
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index afa9c64..262411a 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2416,18 +2416,19 @@ def row_id(view, row):
def paint(p, row, tdattrs=""):
tdclass, content = prepare_paint(p, row)
- if is_stale(row):
- if not tdclass:
- tdclass = 'stale'
- else:
- tdclass += ' stale'
-
if tdclass:
html.write("<td %s class=\"%s\">%s</td>\n" %
(tdattrs, tdclass, content))
else:
html.write("<td %s>%s</td>" % (tdattrs, content))
return content != ""
+def paint_stalified(row, text):
+ if is_stale(row):
+ return "stale", text
+ else:
+ return "", text
+
+
def substract_sorters(base, remove):
for s in remove:
if s in base:
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index 2617f97..a86cb94 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -447,6 +447,7 @@ def paint_is_stale(what, row, tags, custom_vars):
title = _("This host is stale")
else:
title = _("This service is stale")
+ title += _(", no data has been received within the last %.1f check
periods") % config.staleness_threshold
return '<img class=icon title="%s"
src="images/icon_stale.png">' % title
multisite_icons.append({
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 1427ab0..da9e242 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -274,13 +274,15 @@ multisite_painters["sitealias"] = {
# |____/ \___|_| \_/ |_|\___\___||___/
#
-def paint_service_state_short(row ):
+def paint_service_state_short(row):
if row["service_has_been_checked"] == 1:
- state = row["service_state"]
+ state = str(row["service_state"])
name = nagios_short_state_names[row["service_state"]]
else:
state = "p"
name = "PEND"
+ if is_stale(row):
+ state += " stale"
return "state svcstate state%s" % state, name
def paint_host_state_short(row):
@@ -291,6 +293,8 @@ def paint_host_state_short(row):
else:
state = "p"
name = "PEND"
+ if is_stale(row):
+ state += " stale"
return "state hstate hstate%s" % state, name
multisite_painters["service_nagios_link"] = {
@@ -317,25 +321,24 @@ multisite_painters["site_icon"] = {
"sorter" : 'site',
}
-
multisite_painters["svc_plugin_output"] = {
"title" : _("Output of check plugin"),
"short" : _("Status detail"),
"columns" : ["service_plugin_output"],
- "paint" : lambda row: ("",
format_plugin_output(row["service_plugin_output"], row)),
+ "paint" : lambda row: paint_stalified(row,
format_plugin_output(row["service_plugin_output"], row)),
"sorter" : 'svcoutput',
}
multisite_painters["svc_long_plugin_output"] = {
"title" : _("Long output of check plugin (multiline)"),
"short" : _("Status detail"),
"columns" : ["service_long_plugin_output"],
- "paint" : lambda row: (None,
row["service_long_plugin_output"].replace('\\n',
'<br>')),
+ "paint" : lambda row: paint_stalified(row,
row["service_long_plugin_output"].replace('\\n',
'<br>')),
}
multisite_painters["svc_perf_data"] = {
"title" : _("Service performance data"),
"short" : _("Perfdata"),
"columns" : ["service_perf_data"],
- "paint" : lambda row: (None, row["service_perf_data"])
+ "paint" : lambda row: paint_stalified(row,
row["service_perf_data"])
}
def get_perfdata_nth_value(row, n, remove_unit = False):
@@ -357,7 +360,7 @@ def get_perfdata_nth_value(row, n, remove_unit = False):
return str(e)
def paint_perfdata_nth_value(row, n):
- return "", get_perfdata_nth_value(row, n)
+ return paint_stalified(row, get_perfdata_nth_value(row, n))
multisite_painters["svc_perf_val01"] = {
"title" : _("Service performance data - value number 1"),
diff --git a/web/plugins/views/perfometer.py b/web/plugins/views/perfometer.py
index 4e17c58..997f123 100644
--- a/web/plugins/views/perfometer.py
+++ b/web/plugins/views/perfometer.py
@@ -167,6 +167,10 @@ def paint_perfometer(row):
if not perf_data:
return "", ""
+ if is_stale(row):
+ stale_css = " stale"
+ else:
+ stale_css = ""
try:
title, h = perf_painter(row, check_command, perf_data)
content = '<div class=content>%s</div>' % h
@@ -176,9 +180,9 @@ def paint_perfometer(row):
# pnpgraph_present: -1 means unknown (path not configured), 0: no, 1: yes
if 'X' in html.display_options and \
row["service_pnpgraph_present"] != 0:
- return "perfometer", ('<a
href="%s">%s</a>' % (pnp_url(row, "service"), content))
+ return "perfometer" + stale_css, ('<a
href="%s">%s</a>' % (pnp_url(row, "service"), content))
else:
- return "perfometer", content
+ return "perfometer" + stale_css, content
except Exception, e: