Module: check_mk
Branch: master
Commit: 5b757ea59a76f3aab8df697ccf1373c9aaab71b3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5b757ea59a76f3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Apr 1 12:13:58 2013 +0200
FIX: check_mk-mssql_counters.locks: fix computation, was altogether wrong
---
ChangeLog | 1 +
checks/mssql_counters | 24 ++++++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b405865..f246864 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -88,6 +88,7 @@
* FIX: apc_symmetra_power: resurrect garble PNP template for
* FIX: check_mk_agent.freebsd: remove garble from output
(Thanks to Mathias Decker)
+ * FIX: check_mk-mssql_counters.locks: fix computation, was altogether wrong
* check_http: now support the option -L (urlizing the result)
Multisite:
diff --git a/checks/mssql_counters b/checks/mssql_counters
index 5414469..a50fe5c 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -150,6 +150,8 @@ def check_mssql_counters_locks(item, params, info):
state = 0
output = []
perfdata = []
+ now = time.time()
+ wrapped = False
for line in info:
if mssql_counters_item(line, False) != item:
continue
@@ -163,21 +165,31 @@ def check_mssql_counters_locks(item, params, info):
if line[1] == counter:
prob_txt = ''
value = float(line[-1])
+ # compute rate from counter value
+ countername = "mssql_counters.%s.%s" % (item, counter)
+ try:
+ timedif, persec = get_counter(countername, now, value)
+ except MKCounterWrapped:
+ wrapped = True
+ continue
p = params.get(counter)
if p:
warn, crit = p
- if value > crit:
+ if persec > crit:
state = max(state, 1)
- prob_txt = ' (!)'
- elif value > warn:
+ prob_txt = '(!)'
+ elif persec > warn:
state = max(state, 2)
- prob_txt = ' (!!)'
+ prob_txt = '(!!)'
else:
warn, crit = None, None
- output.append('%s: %d/s%s' % (label, value, prob_txt))
- perfdata.append((counter, value, warn, crit))
+ output.append('%s: %.1f/s%s' % (label, persec, prob_txt))
+ perfdata.append((counter, persec, warn, crit))
+
+ if wrapped:
+ raise MKCounterWrapped("", "Some counter wrapped, no data this
time")
if output:
return (state, ', '.join(output), perfdata)