Module: check_mk
Branch: master
Commit: fa61d1b8b149a12e7f0621ff14752c96b6c5040e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fa61d1b8b149a1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Aug 29 13:23:45 2016 +0200
3864 tactical overview now shows the number of stale hosts and services
---
.werks/3864 | 9 +++++++++
ChangeLog | 1 +
web/plugins/sidebar/shipped.py | 30 +++++++++++++++++++++---------
web/plugins/views/builtin.py | 24 ++++++++++++++++++++++++
4 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/.werks/3864 b/.werks/3864
new file mode 100644
index 0000000..6537c99
--- /dev/null
+++ b/.werks/3864
@@ -0,0 +1,9 @@
+Title: tactical overview now shows the number of stale hosts and services
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1472469803
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index bb371e2..9edb61e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -145,6 +145,7 @@
* 3793 f5_bigip_vserver: traffic and packet levels are now configurable
* 3794 f5_bigip_snat: now able to configure levels
* 3795 cisco_cpu_multiitem: monitors the cpu utilization of each cpu
+ * 3864 tactical overview now shows the number of stale hosts and services
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index ecfe7be..a5f0019 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -547,6 +547,8 @@ table.sitestate td.state {
# '----------------------------------------------------------------------'
def get_tactical_overview_data(extra_filter_headers):
+ configured_staleness_threshold = config.staleness_threshold
+
host_query = \
"GET hosts\n" \
"Stats: state >= 0\n" \
@@ -557,6 +559,7 @@ def get_tactical_overview_data(extra_filter_headers):
"Stats: scheduled_downtime_depth = 0\n" \
"Stats: acknowledged = 0\n" \
"StatsAnd: 3\n" \
+ "Stats: host_staleness >= %s\n" % configured_staleness_threshold +
\
"Filter: custom_variable_names < _REALNAME\n" + \
extra_filter_headers
@@ -574,6 +577,7 @@ def get_tactical_overview_data(extra_filter_headers):
"Stats: acknowledged = 0\n" \
"Stats: host_state = 0\n" \
"StatsAnd: 5\n" \
+ "Stats: service_staleness >= %s\n" % configured_staleness_threshold
+ \
"Filter: host_custom_variable_names < _REALNAME\n" + \
extra_filter_headers
@@ -584,6 +588,7 @@ def get_tactical_overview_data(extra_filter_headers):
stat_only=True)
if notdata is None:
notdata = [0]
+
except livestatus.MKLivestatusNotFoundError:
return None, None, None
@@ -600,22 +605,29 @@ def render_tactical_overview(extra_filter_headers="",
extra_url_variables=None):
return
html.write("<table class=\"content_center tacticaloverview\"
cellspacing=2 cellpadding=0 border=0>\n")
- for title, data, view, what in [
- (_("Hosts"), hstdata, 'hostproblems', 'host'),
- (_("Services"), svcdata, 'svcproblems',
'service')]:
-
html.write("<tr><th>%s</th><th>%s</th><th>%s</th></tr>\n"
% (title, _('Problems'), _('Unhandled')))
+ for title, data, view, stale_view, what in [
+ (_("Hosts"), hstdata, 'hostproblems',
'stale_hosts', 'host'),
+ (_("Services"), svcdata, 'svcproblems',
'uncheckedsvc', 'service')]:
+
+ amount, problems, unhandled_problems, stales = data
+
html.write("<tr><th>%s</th><th>%s</th><th>%s</th>"
+ "<th>%s</th></tr>\n" % (title,
_('Problems'), _('Unhandled'), _("Stale")))
html.write("<tr>")
url = html.makeuri_contextless([("view_name", "all" + what +
"s")] + extra_url_variables, filename="view.py")
- html.write('<td class=total><a target="main"
href="%s">%d</a></td>' % (url, data[0]))
- unhandled = False
- for value in data[1:]:
+ html.write('<td class=total><a target="main"
href="%s">%d</a></td>' % (url, amount))
+
+ for value, unhandled in [ (problems, False), (unhandled_problems, True) ]:
url = html.makeuri_contextless([("view_name", view)] +
extra_url_variables, filename="view.py")
if unhandled:
url += "&is_%s_acknowledged=0" % what
text = link(str(value), url)
html.write('<td class="%s">%s</td>' % (value ==
0 and " " or "states prob", text))
- unhandled = True
+
+ url = html.makeuri_contextless([("view_name", stale_view)] +
extra_url_variables, filename="view.py")
+ text = link(str(stales), url)
+ html.write('<td class="%s">%s</td>' % (stales == 0
and " " or "states prob", text))
+
html.write("</tr>\n")
html.write("</table>\n")
@@ -656,7 +668,7 @@ table.tacticaloverview th {
vertical-align: bottom;
}
table.tacticaloverview td {
- width: 33.3%%;
+ width: 25%%;
text-align: right;
/* border: 1px solid #123a4a; */
background-color: #6da1b8;
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 3dd1e57..f905f88 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -1710,6 +1710,30 @@ multisite_builtin_views.update({
'title': _('Stale services'),
'topic': _('Problems'),
'user_sortable': 'on'},
+ 'stale_hosts' : {'browser_reload': 30,
+ 'column_headers': 'pergroup',
+ 'datasource': 'hosts',
+ 'description': _('Hosts that have not been checked for too
long.'),
+ 'group_painters': [('sitealias', None)],
+ 'hard_filters': ['host_staleness'],
+ 'hard_filtervars': [('is_host_staleness',
'1')],
+ 'hidden': True,
+ 'hide_filters': [],
+ 'hidebutton': False,
+ 'icon': None,
+ 'layout': 'boxed',
+ 'mobile': False,
+ 'mustsearch': False,
+ 'name': 'stale_hosts',
+ 'num_columns': 1,
+ 'painters': host_view_painters,
+ 'play_sounds': False,
+ 'public': True,
+ 'show_filters': [],
+ 'sorters': [('site_host', False), ('host_name',
False)],
+ 'title': _('Stale hosts'),
+ 'topic': _('Problems'),
+ 'user_sortable': 'on'},
'events': {'browser_reload': 0,
'column_headers': 'pergroup',
'datasource': 'log_events',