Module: check_mk
Branch: master
Commit: da5a071ba30594fe9908e938517fdc52f6c5a134
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=da5a071ba30594…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Dec 17 14:14:05 2014 +0100
#1207 services: Check can now be configured with additional names for matching
If you want to configure windows service monitoring manually on multiple hosts at once,
but the service name is not always
the same, this now can be configured with one single rule.
---
.werks/1207 | 11 +++++++++++
ChangeLog | 1 +
checks/services | 12 ++++++++----
web/plugins/wato/check_parameters.py | 7 +++++++
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/.werks/1207 b/.werks/1207
new file mode 100644
index 0000000..f404f3d
--- /dev/null
+++ b/.werks/1207
@@ -0,0 +1,11 @@
+Title: services: Check can now be configured with additional names for matching
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1418821879
+Class: feature
+
+If you want to configure windows service monitoring manually on multiple hosts at once,
but the service name is not always
+the same, this now can be configured with one single rule.
+
diff --git a/ChangeLog b/ChangeLog
index ec826ec..d6ac2d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
* 1665 agent_netapp: New special agent for NetApp monitoring via Web-API...
* 1782 msexch_replhealth: new check for monitoring health of MS Exchange DAG
* 1458 msexch_dag.contentindex, msexch_dag.copyqueue, msexch_dag.dbcopy: new checks
for MS Exchange Mailbox Servers in a DAG...
+ * 1207 services: Check can now be configured with additional names for matching...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/services b/checks/services
index a868944..6456bb9 100644
--- a/checks/services
+++ b/checks/services
@@ -176,7 +176,7 @@ def inventory_windows_services(info):
def check_windows_services(item, params, info):
# Hack for old manually defined checks:
if params == None:
- params = factory_settings["services_default_levels"];
+ params = factory_settings["services_default_levels"]
# A service may appear more than once (due to clusters).
# First make a list of all matching entries with their
@@ -185,7 +185,10 @@ def check_windows_services(item, params, info):
for line in info:
# allow to match agains the internal name or agains the display name
# of the service
- if item == line[1] or item == " ".join(line[3:]):
+ display_name = " ".join(line[3:])
+ if item == line[1] or item == display_name \
+ or line[1] in params['additional_servicenames'] \
+ or display_name in params['additional_servicenames']:
# newer agents also send start type as part of state,
# e.g. running/auto
if '/' in line[2]:
@@ -222,8 +225,9 @@ def check_windows_services(item, params, info):
factory_settings["services_default_levels"] = {
- "states" : [ ( "running", None, 0 ) ],
- "else" : 2,
+ "states" : [ ( "running", None, 0 ) ],
+ "else" : 2,
+ "additional_servicenames" : [],
}
check_info['services'] = {
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 3af6cf6..03ad8bd 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4868,6 +4868,13 @@ register_check_parameters(
_("Windows Services"),
Dictionary(
elements = [
+ ( "additional_servicenames",
+ ListOfStrings(
+ title = _("Additional names for the service"),
+ help = _("If the service have diffrent names on diffrent "
+ "Hosts, you can use this option to match them in one
rule"),
+ )
+ ),
( "states",
ListOf(
Tuple(