Module: check_mk
Branch: master
Commit: 1aebaff13726f5e8fd30d9481566e6f0ecc5308b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1aebaff13726f5…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Oct 24 13:50:29 2017 +0200
5325 mssql_counters.cache_hits: Discover services for which the agent plugins does not
provide any base for the counter 'cache_hits'
Some base values for counters might be zero or None
if they are currently not available, eg.
MSSQL_FOOBAR:Databases log_cache_hit_ratio ANY-PATH 0
MSSQL_FOOBAR:Databases log_cache_hit_ratio_base ANY-PATH 0
This may lead to a flapping state of the
{{Check_MK Discovery Service}} which reports vanished services.
Change-Id: I86209ba8e32da035b4550d9f3572750792511011
---
.werks/5325 | 15 +++++++++++++++
checks/mssql_counters | 13 +++++++++----
web/plugins/wato/check_parameters.py | 11 +++++++++++
3 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/.werks/5325 b/.werks/5325
new file mode 100644
index 0000000..9b887f3
--- /dev/null
+++ b/.werks/5325
@@ -0,0 +1,15 @@
+Title: mssql_counters.cache_hits: Discover services for which the agent plugins does not
provide any base for the counter 'cache_hits'
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1508845164
+Class: feature
+
+Some base values for counters might be zero or None
+if they are currently not available, eg.
+MSSQL_FOOBAR:Databases log_cache_hit_ratio ANY-PATH 0
+MSSQL_FOOBAR:Databases log_cache_hit_ratio_base ANY-PATH 0
+This may lead to a flapping state of the
+{{Check_MK Discovery Service}} which reports vanished services.
diff --git a/checks/mssql_counters b/checks/mssql_counters
index acab476..a60a6df 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -54,12 +54,15 @@ def mssql_counters_item(line, add_counter_name):
return obj + ' ' + instance
-def inventory_mssql_counters(info, want_counters, perc_w_base, add_counter_name, dflt =
None):
+inventory_mssql_counters_rules = []
+
+
+def inventory_mssql_counters(info, want_counters, perc_w_base, add_counter_name,
dflt=None):
+ rules = host_extra_conf_merged(host_name(), inventory_mssql_counters_rules)
inventory = []
for line in info:
if line[1] in want_counters:
this_counter = line[1]
-
# Get the base value for perc values
if perc_w_base:
base = 0.0
@@ -68,8 +71,10 @@ def inventory_mssql_counters(info, want_counters, perc_w_base,
add_counter_name,
mssql_counters_item(line, add_counter_name) + '_base':
base = float(line2[-1])
break
- if base == 0.0:
- continue # Skip counters where base is "0"
+ if base == 0.0 and not rules.get('add_zero_based_services',
False):
+ # Skip counters where base is "0"
+ # Only cache_hits could have counters with base == 0.0
+ continue
inventory.append((mssql_counters_item(line, add_counter_name), dflt))
return inventory
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 4bd76ed..8ee2ce3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1561,6 +1561,17 @@ register_rule(group + '/' + subgroup_inventory,
match = "dict",
)
+register_rule(group + '/' + subgroup_inventory,
+ varname = "inventory_mssql_counters_rules",
+ title = _("Include MSSQL Counters services"),
+ valuespec = Dictionary(elements=[
+ ("add_zero_based_services", Checkbox(title=_("Include service
with zero base."))),
+ ],
+ optional_keys = []
+ ),
+ match = "dict",
+)
+
#.
# .--Applications--------------------------------------------------------.
# | _ _ _ _ _ |