Module: check_mk
Branch: master
Commit: 3ab69ddf206a61f0caf13cbb0ba18cfb05f51a0a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ab69ddf206a61…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Mar 22 14:39:53 2017 +0100
8626 FIX jolokia_metrics.threads: Prevent service staleness in case of decreasing threads
Previously, the check would go stale occasionally due to a decreasing number of threads
being interpreted as a counter wrap. This has been fixed.
Change-Id: I42e516116f8471b5d9ef4c20bb4b53017ed9d5b6
---
.werks/8626 | 12 ++++++++++++
checks/jolokia_metrics | 16 ++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/.werks/8626 b/.werks/8626
new file mode 100644
index 0000000..c5af1a2
--- /dev/null
+++ b/.werks/8626
@@ -0,0 +1,12 @@
+Title: jolokia_metrics.threads: Prevent service staleness in case of decreasing threads
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1490189869
+
+Previously, the check would go stale occasionally due to a decreasing number of threads
+being interpreted as a counter wrap. This has been fixed.
diff --git a/checks/jolokia_metrics b/checks/jolokia_metrics
index 0bc9144..5b0f414 100644
--- a/checks/jolokia_metrics
+++ b/checks/jolokia_metrics
@@ -653,7 +653,6 @@ def check_jolokia_metrics_threads(item, params, info):
d = parsed[item]
this_time = time.time()
- wrapped = False
perfdata = []
output = []
status = 0
@@ -673,20 +672,13 @@ def check_jolokia_metrics_threads(item, params, info):
status_info = "(!) (Levels at %d/%d)" % (warn, crit)
# Calculate the thread increase rate
- try:
- rate = get_rate("jolokia_metrics.threads.%s" % item, this_time,
val)
- output.append('ThreadRate: %0.2f' % rate)
- perfdata.append(('ThreadRate', rate))
- except MKCounterWrapped:
- wrapped = True
+ rate = get_rate("jolokia_metrics.threads.%s" % item, this_time,
val, allow_negative=True)
+ output.append('ThreadRate: %0.2f' % rate)
+ perfdata.append(('ThreadRate', rate))
perfdata.append((key, val))
output.append('%s: %d%s' % (key, val, status_info))
- # Only process the perfdata when no wrap occured
- if wrapped:
- return (status, ', '.join(output))
- else:
- return (status, ', '.join(output), perfdata)
+ return (status, ', '.join(output), perfdata)
check_info["jolokia_metrics.threads"] = {