Module: check_mk
Branch: master
Commit: b812ad97d5664852279507db616333dd9d450777
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b812ad97d56648…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun May 13 12:10:29 2012 +0200
Finished formalization of check_ldap
---
ChangeLog | 1 +
checks/check_ldap | 63 +++++++++++++++++++++++++++++++++++++
web/plugins/wato/active_checks.py | 4 ++
3 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 09215ae..c537cf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* FIX: Logwatch: fixed missing linebreak during reclassifing lines of logfiles
* FIX: Logwatch: Logwatch services in rules configured using WATO must be
given as item, not as whole service name
+ * New active check via WATO: check_ldap
BI:
* FIX: make rotating folding arrows black (white was not visible)
diff --git a/checks/check_ldap b/checks/check_ldap
new file mode 100644
index 0000000..8f46f8c
--- /dev/null
+++ b/checks/check_ldap
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+def check_ldap_arguments(params):
+ name, basedn, settings = params
+ args = ' -b %s' % quote_shell_string(basedn)
+
+ if "response_time" in settings:
+ args += ' -w %f -c %f' % (
+ settings["response_time"][0]/1000.0,
+ settings["response_time"][1]/1000.0)
+
+ if "timeout" in settings:
+ args += ' -t %d' % settings["timeout"]
+
+ if "attribute" in settings:
+ args += ' -a %s' % quote_shell_string(settings["attribute"])
+
+ if "authentication" in settings:
+ binddn, password = settings["authentication"]
+ args += ' -D %s -P %s' % (
+ quote_shell_string(binddn),
+ quote_shell_string(password))
+
+ if "port" in settings:
+ args += ' -p %d' % settings["port"]
+
+ if settings.get("ssl"):
+ args += ' --ssl'
+
+ return args
+
+
+active_check_info['ldap'] = {
+ "command_line" : '$USER1$/check_ldap -H $HOSTADDRESS$
$ARG1$',
+ "argument_function" : check_ldap_arguments,
+ "service_description" : lambda args: "LDAP " + args[0],
+ "has_perfdata" : True,
+}
+
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 0308db4..ea82ea6 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -391,6 +391,10 @@ register_rule(group,
"Nagios plugins in order to try the response of an LDAP "
"server."),
elements = [
+ TextUnicode(
+ title = _("Name"),
+ help = _("The service description will be <b>LDAP</b>
plus this name"),
+ allow_empty = False),
TextAscii(
title = _("Base DN"),
help = _("LDAP base, e.g. ou=Development, o=Mathias Kettner GmbH,
c=de"),