Module: check_mk
Branch: master
Commit: d015fdd672532e4dd7cedcad1c6b1852caa93262
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d015fdd672532e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 16 15:20:50 2013 +0100
FIX Introduce time limit on availability queries
The availability view now imposes an upper limit on the execution of the
underlying livestatus query. The default is 30 seconds. This can be configured
in the reporting options. This limit keeps the system usable in situations
where a query over a long time range would need a very long time to execute.
---
.werks/338 | 13 +++++++++++++
ChangeLog | 1 +
web/plugins/views/availability.py | 13 +++++++++++++
3 files changed, 27 insertions(+)
diff --git a/.werks/338 b/.werks/338
new file mode 100644
index 0000000..ac3f467
--- /dev/null
+++ b/.werks/338
@@ -0,0 +1,13 @@
+Title: Introduce time limit on availability queries
+Level: 2
+Component: reporting
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387203559
+Targetversion: future
+
+The availability view now imposes an upper limit on the execution of the
+underlying livestatus query. The default is 30 seconds. This can be configured
+in the reporting options. This limit keeps the system usable in situations
+where a query over a long time range would need a very long time to execute.
diff --git a/ChangeLog b/ChangeLog
index 80ddcf8..12dff53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,7 @@
Reporting & Availability:
* 0018 New option for displaying a legend for the colors used in the timeline...
+ * 0338 FIX: Introduce time limit on availability queries...
Event Console:
* 0301 Handling messages of special syslog format correctly...
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index ba300b7..8db618f 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -391,6 +391,17 @@ avoption_entries = [
label = _("Show timeline of each object directly in table")),
),
+ # Timelimit
+ ( "timelimit",
+ "single",
+ Age(
+ title = _("Query Time Limit"),
+ default_value = 30,
+ unit = _("sec"),
+ help = _("Limit the execution time of the query, in order to "
+ "avoid a hanging system."),
+ ),
+ )
]
@@ -431,6 +442,7 @@ def render_availability_options():
"av_levels" : None,
"av_mode" : False,
"grouping" : None,
+ "timelimit" : 30,
}
# Users of older versions might not have all keys set. The following
@@ -573,6 +585,7 @@ def get_availability_data(datasource, filterheaders, range,
only_sites, limit, s
av_filter += "Filter: service_description =\n"
query = "GET statehist\n" + av_filter
+ query += "Timelimit: %d\n" % avoptions["timelimit"]
# Add Columns needed for object identification
columns = [ "host_name", "service_description" ]