Module: check_mk
Branch: master
Commit: 9001c70a333fa8c3daf7901b91c68b7b644dabbf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9001c70a333fa8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Apr 11 11:31:11 2017 +0200
4584 FIX mssql_counters.pageactivity: Raised always a MKCounterWrapped which resulted in
PENDING service state; Fixed that.
Change-Id: Icb776f75d67a497cb1df09a343c5cf0917118764
---
.werks/4584 | 11 +++++++++++
checks/mssql_counters | 18 ++++++++++--------
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/.werks/4584 b/.werks/4584
new file mode 100644
index 0000000..e87db0e
--- /dev/null
+++ b/.werks/4584
@@ -0,0 +1,11 @@
+Title: mssql_counters.pageactivity: Raised always a MKCounterWrapped which resulted in
PENDING service state; Fixed that.
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1491902865
+
+
diff --git a/checks/mssql_counters b/checks/mssql_counters
index b6edd79..acab476 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -309,17 +309,19 @@ def check_mssql_counters_pageactivity(item, params, info):
if now is None:
now = time.time()
+ found = False
for line in info:
if mssql_counters_item(line, False) != item:
continue
for counter, label in mssql_pageactivity_counters:
if line[1] == counter:
- reading = float(line[-1])
+ found = True
+ reading = float(line[-1])
countername = "mssql_counters_pageactivity.%s.%s" % (item,
counter)
- rate = get_rate(countername, now, reading)
- state = 0
- infotext = "%s %.1f/sec" % (label, rate)
+ rate = get_rate(countername, now, reading)
+ state = 0
+ infotext = "%s %.1f/sec" % (label, rate)
if params.get(counter):
warn, crit = params[counter]
@@ -334,12 +336,12 @@ def check_mssql_counters_pageactivity(item, params, info):
else:
perfdata = [ (counter, rate) ]
-
yield state, infotext, perfdata
- # Assume general connection problem to the database, which is reported
- # by the "X Instance" service and skip this check.
- raise MKCounterWrapped("Failed to connect to database")
+ if not found:
+ # Assume general connection problem to the database, which is reported
+ # by the "X Instance" service and skip this check.
+ raise MKCounterWrapped("Failed to connect to database")
check_info['mssql_counters.pageactivity'] = {