Module: check_mk
Branch: master
Commit: a9a45eb29962c1d6002df28879a0868befec4d04
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a9a45eb29962c1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jul 29 11:47:54 2013 +0200
New filter for current notification number
---
ChangeLog | 7 ++++---
web/plugins/dashboard/builtin.py | 2 +-
web/plugins/views/builtin.py | 9 +++++++--
web/plugins/views/filters.py | 37 +++++++++++++++++++++++++++++++++++--
web/plugins/views/painters.py | 4 ++--
5 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5423ebb..cf9864c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,12 +96,13 @@
* Editing localized strings (like the title) is now optional when cloning
views or editing cloned views. If not edited, the views inherit the
localized strings from their ancestors
+ * Added simple problems Dashboard
+ * New filter and column painter for current notification number (escalations)
* FIX: better error message in case of exception in SNMP handling
* FIX: Inventory screen: Now shows custom checks
* FIX: Fixed locking problem of multisite pages related to user loading/saving
* FIX: Fixed wrong default settings of view filters in localized multisite
* FIX: line wrapping of logwatch entries
- * Add: Added simple problems Dashboard
WATO:
* Allow to configure check-/retry_interval in second precision
@@ -111,8 +112,8 @@
* Custom user attributes can now be managed using WATO
* FIX: do validation of check items in rule editor
* FIX: More consistent handling of folderpath select in rule editor
- * Add: Require unique alias names in between the following elements:
- Host/Service/Contact Groups, Timeperiods and Roles
+ * Require unique alias names in between the following elements:
+ Host/Service/Contact Groups, Timeperiods and Roles
Notifications:
* Flexible Notification can now filter service levels
diff --git a/web/plugins/dashboard/builtin.py b/web/plugins/dashboard/builtin.py
index c474b2f..92d4a0c 100644
--- a/web/plugins/dashboard/builtin.py
+++ b/web/plugins/dashboard/builtin.py
@@ -88,7 +88,7 @@ if defaults.omd_site:
}
builtin_dashboards["simple_problems"] = {
- "title" : _("Problems Dashboard"),
+ "title" : _("Host & Services Problems"),
"dashlets" : [
{
"title" : _("Host Problems (unhandled)"),
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 6dd78a2..013674e 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -893,6 +893,7 @@ multisite_builtin_views.update({
('host_plugin_output', None),
('host_perf_data', None),
('host_attempt', None),
+ ('host_notification_number', None),
('host_check_interval', None),
('host_check_type', None),
('host_state_age', None),
@@ -992,7 +993,8 @@ multisite_builtin_views.update({
'opthost_contactgroup',
'host_check_command',
'host_address',
- ],
+ 'host_notif_number',
+ ],
'sorters': [],
'title': _('Host search'),
'topic': _('Hosts')},
@@ -1067,7 +1069,9 @@ multisite_builtin_views.update({
'svc_last_state_change',
'svc_last_check',
'siteopt',
- 'aggr_service_used'],
+ 'aggr_service_used',
+ 'svc_notif_number',
+ ],
'sorters': [('site', False),
('site_host', False),
('svcdescr', False)],
@@ -1102,6 +1106,7 @@ multisite_builtin_views.update({
('svc_check_command', None),
('svc_check_interval', None),
('svc_attempt', None),
+ ('svc_notification_number', None),
('svc_check_type', None),
('svc_state_age', None),
('svc_check_age', None),
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index 0a1cdc8..321870b 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -351,8 +351,8 @@ declare_filter(132, FilterNagiosFlag("host",
"host_active_checks_enabled",
declare_filter(133, FilterNagiosFlag("host",
"host_notifications_enabled", _("Host notifications enabled")))
declare_filter(230, FilterNagiosFlag("service",
"service_acknowledged", _("Problem acknowledged")))
declare_filter(231, FilterNagiosFlag("service",
"service_in_notification_period", _("Service in notif. per.")))
-declare_filter(232, FilterNagiosFlag("service",
"service_active_checks_enabled", _("Active checks enabled")))
-declare_filter(233, FilterNagiosFlag("service",
"service_notifications_enabled", _("Notifications enabled")))
+declare_filter(233, FilterNagiosFlag("service",
"service_active_checks_enabled", _("Active checks enabled")))
+declare_filter(234, FilterNagiosFlag("service",
"service_notifications_enabled", _("Notifications enabled")))
declare_filter(236, FilterNagiosFlag("service",
"service_is_flapping", _("Flapping")))
declare_filter(231, FilterNagiosFlag("service",
"service_scheduled_downtime_depth", _("Service in downtime")))
declare_filter(132, FilterNagiosFlag("host",
"host_scheduled_downtime_depth", _("Host in downtime")))
@@ -396,6 +396,39 @@ class FilterSite(Filter):
declare_filter(500, FilterSite("siteopt", False), _("Optional selection of
a site"))
declare_filter(501, FilterSite("site", True), _("Selection of site is
enforced, use this filter for joining"))
+# name: internal id of filter
+# title: user displayed title of the filter
+# info: usually either "host" or "service"
+# column: a livestatus column of type int or float
+class FilterNumberRange(Filter): # type is int
+ def __init__(self, name, title, info, column):
+ self.column = column
+ varnames = [ name + "_from", name + "_until" ]
+ Filter.__init__(self, name, title, info, varnames, [])
+
+ def display(self):
+ html.write(_("From:") + " ")
+ html.text_input(self.htmlvars[0], style="width: 80px;")
+ html.write(" " + _("To:") +
" ")
+ html.text_input(self.htmlvars[1], style="width: 80px;")
+
+ def filter(self, tablename):
+ lql = ""
+ for i, op in [ (0, ">="), (1, "<=") ]:
+ try:
+ txt = html.var(self.htmlvars[i])
+ int(txt.strip())
+ lql += "Filter: %s %s %s\n" % (self.column, op, txt.strip())
+ except:
+ pass
+ return lql
+
+
+declare_filter(232, FilterNumberRange("host_notif_number", _("Current Host
Notification Number"), "host", "current_notification_number"))
+declare_filter(232, FilterNumberRange("svc_notif_number", _("Current
Service Notification Number"), "service",
"current_notification_number"))
+
+
+
# Filter for setting time ranges, e.g. on last_state_change and last_check
# Variante eins:
# age [ ] seconds [ ] minutes [ ] hours [ ] days
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index f2b6969..bd297af 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -515,7 +515,7 @@ multisite_painters['svc_notification_number'] = {
"title" : _("Service notification number"),
"short" : _("N#"),
"columns" : [ "service_current_notification_number" ],
- "paint" : lambda row: ("count",
row["service_current_notification_number"]),
+ "paint" : lambda row: ("",
row["service_current_notification_number"]),
}
@@ -922,7 +922,7 @@ multisite_painters['host_notification_number'] = {
"title" : _("Host notification number"),
"short" : _("N#"),
"columns" : [ "host_current_notification_number" ],
- "paint" : lambda row: ("count",
saveint(row["host_current_notification_number"])),
+ "paint" : lambda row: ("",
saveint(row["host_current_notification_number"])),
}
multisite_painters["host_flapping"] = {