Module: check_mk
Branch: master
Commit: ab94d29f7f808a0c764449142101bc59c2f70f9c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab94d29f7f808a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 26 12:19:14 2013 +0200
New config option: staleness_threshold to configure the former hardcoded value of 1.5
---
ChangeLog | 1 +
web/htdocs/views.py | 2 +-
web/plugins/config/builtin.py | 4 ++++
web/plugins/views/filters.py | 8 ++++----
web/plugins/wato/check_mk_configuration.py | 14 ++++++++++++++
5 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3c1d954..9094a95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -121,6 +121,7 @@
* Improved filtering of the foldertree snapin by user permissions (when a user is
only permitted on one child folder, the upper folder is removed from the
hierarchy)
+ * "Unchecked Services" view now uses the staleness of services for
filtering
* 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
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index ac1711d..b323e9b 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2600,7 +2600,7 @@ def get_host_tags(row):
return ""
def is_stale(row):
- return row.get('service_staleness', row.get('host_staleness', 0))
>= 1.5
+ return row.get('service_staleness', row.get('host_staleness', 0))
>= config.staleness_threshold
def cmp_insensitive_string(v1, v2):
c = cmp(v1.lower(), v2.lower())
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index 8e55c24..78e1612 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -195,6 +195,10 @@ adhoc_downtime = {}
# Display dashboard date
pagetitle_date_format = None
+# Value of the host_staleness/service_staleness field to make hosts/services
+# appear in a stale state
+staleness_threshold = 1.5
+
# _ _ ____ ____
# | | | |___ ___ _ __| _ \| __ )
# | | | / __|/ _ \ '__| | | | _ \
diff --git a/web/plugins/views/filters.py b/web/plugins/views/filters.py
index 19caaa4..af545dd 100644
--- a/web/plugins/views/filters.py
+++ b/web/plugins/views/filters.py
@@ -362,11 +362,11 @@ declare_filter(232, FilterNagiosExpression("service",
"in_downtime",
"Filter: service_scheduled_downtime_depth = 0\nFilter:
host_scheduled_downtime_depth = 0\nAnd: 2\n"))
declare_filter(232, FilterNagiosExpression("host", "host_staleness",
_("Host is stale"),
- "Filter: host_staleness >= 1.5\n",
- "Filter: host_staleness < 1.5\n"))
+ "Filter: host_staleness >= %0.2f\n" %
config.staleness_threshold,
+ "Filter: host_staleness < %0.2f\n" %
config.staleness_threshold))
declare_filter(232, FilterNagiosExpression("service",
"service_staleness", _("Service is stale"),
- "Filter: service_staleness >= 1.5\n",
- "Filter: service_staleness < 1.5\n"))
+ "Filter: service_staleness >= %0.2f\n" %
config.staleness_threshold,
+ "Filter: service_staleness < %0.2f\n" %
config.staleness_threshold))
class FilterSite(Filter):
def __init__(self, name, enforce):
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 54b7cf6..1201edc 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -332,6 +332,20 @@ register_configvar(group,
),
domain = "multisite")
+register_configvar(group,
+ "staleness_threshold",
+ Float(
+ title = _('Staleness value to mark hosts / services stale'),
+ help = _('The staleness value of a host / service is calculated by measuring
the '
+ 'configured check intervals a check result is old. A value of 1.5
means the '
+ 'current check result has been gathered one and a half check
intervals of an object. '
+ 'This would mean 90 seconds in case of a check which is checked
each 60 seconds.'),
+ minvalue = 1,
+ default_value = 1.5,
+ ),
+ domain = "multisite",
+)
+
# .--WATO----------------------------------------------------------------.
# | __ ___ _____ ___ |