Module: check_mk
Branch: master
Commit: a3e72831d79c5816e0a51fbc1b7d57f40e633ca7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3e72831d79c58…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Jul 6 11:11:03 2015 +0200
#1262 check_dns, check_ldap, check_smtp: It is now possible to customize the service
descriptions of this checks.
---
.werks/1262 | 9 +++++++++
ChangeLog | 1 +
checks/check_dns | 7 ++++++-
checks/check_ldap | 6 +++++-
checks/check_smtp | 6 +++++-
web/plugins/wato/active_checks.py | 12 ++++++++++--
6 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/.werks/1262 b/.werks/1262
new file mode 100644
index 0000000..841e5e7
--- /dev/null
+++ b/.werks/1262
@@ -0,0 +1,9 @@
+Title: check_dns, check_ldap, check_smtp: It is now possible to customize the service
descriptions of this checks.
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1436173822
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 45f11fc..e656e5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* 2398 agent_vsphere: now able to opt-out of servers ssl certifcate check...
* 2448 Various Checks for Citrix XenApp 7.x Farms...
* 2399 agent_vsphere/esx_vsphere_counters.if: now also reports interface state,
bandwidth and mac address...
+ * 1262 check_dns, check_ldap, check_smtp: It is now possible to customize the service
descriptions of this checks.
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/check_dns b/checks/check_dns
index ebc54f4..8ea2887 100644
--- a/checks/check_dns
+++ b/checks/check_dns
@@ -54,10 +54,15 @@ def check_dns_arguments(params):
return args
+def check_dns_desc(params):
+ if "name" in params[1]:
+ return params[1]['name']
+ return "DNS %s" % params[0]
+
active_check_info['dns'] = {
"command_line" : '$USER1$/check_dns $ARG1$',
"argument_function" : check_dns_arguments,
- "service_description" : lambda params: "DNS %s" % params[0],
+ "service_description" : check_dns_desc,
"has_perfdata" : True,
}
diff --git a/checks/check_ldap b/checks/check_ldap
index c022acc..1ea4e06 100644
--- a/checks/check_ldap
+++ b/checks/check_ldap
@@ -60,11 +60,15 @@ def check_ldap_arguments(params):
return args
+def check_ldap_desc(params):
+ if params[0].startswith("^"):
+ return params[0][1:]
+ return "LDAP %s" % params[0]
active_check_info['ldap'] = {
"command_line" : '$USER1$/check_ldap -H $HOSTADDRESS$
$ARG1$',
"argument_function" : check_ldap_arguments,
- "service_description" : lambda args: "LDAP " + args[0],
+ "service_description" : check_ldap_desc,
"has_perfdata" : True,
}
diff --git a/checks/check_smtp b/checks/check_smtp
index bc75c0b..493dd6e 100644
--- a/checks/check_smtp
+++ b/checks/check_smtp
@@ -77,11 +77,15 @@ def check_smtp_arguments(params):
args += ' -H $HOSTADDRESS$'
return args
+def check_smtp_desc(params):
+ if params[0].startswith("^"):
+ return params[0][1:]
+ return "SMTP %s" % params[0]
active_check_info['smtp'] = {
"command_line" : '$USER1$/check_smtp $ARG1$',
"argument_function" : check_smtp_arguments,
- "service_description" : lambda params: "SMTP %s" % params[0],
+ "service_description" : check_smtp_desc,
"has_perfdata" : True,
}
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index e0b4253..59c72c9 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -331,6 +331,12 @@ register_rule(group,
Dictionary(
title = _("Optional parameters"),
elements = [
+ ("name",
+ TextUnicode(
+ title = _("Alternative Service description"),
+ help = _("The service description will be this name
instead <i>DNS Servername</i>"),
+ )
+ ),
( "server",
Alternative(
title = _("DNS Server"),
@@ -1012,7 +1018,8 @@ register_rule(group,
elements = [
TextUnicode(
title = _("Name"),
- help = _("The service description will be <b>LDAP</b>
plus this name"),
+ help = _("The service description will be <b>LDAP</b>
plus this name. If the name starts with "
+ "a caret (<tt>^</tt>), the service description
will not be prefixed with <tt>LDAP</tt>." ),
allow_empty = False),
TextAscii(
title = _("Base DN"),
@@ -1115,7 +1122,8 @@ register_rule(group,
elements = [
TextUnicode(
title = _("Name"),
- help = _("The service description will be <b>SMTP</b>
plus this name"),
+ help = _("The service description will be <b>SMTP</b>
plus this name. If the name starts with "
+ "a caret (<tt>^</tt>), the service description
will not be prefixed with <tt>SMTP</tt>." ),
allow_empty = False),
Dictionary(
title = _("Optional parameters"),