aboutsummaryrefslogtreecommitdiffstats
path: root/nagios-plugins/check_ldap_root
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-plugins/check_ldap_root')
-rwxr-xr-xnagios-plugins/check_ldap_root24
1 files changed, 24 insertions, 0 deletions
diff --git a/nagios-plugins/check_ldap_root b/nagios-plugins/check_ldap_root
new file mode 100755
index 0000000..a4ce47f
--- /dev/null
+++ b/nagios-plugins/check_ldap_root
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Make sure the LDAP server is able to respond by searching for the
+# root DSE.
+
+set -e
+
+PATH=/bin:/sbin:/usr/sbin:/usr/bin
+
+if [ -z "$1" ] ; then
+ echo "No LDAP server specified on command line"
+ exit 1
+fi
+
+ldapserver=$1
+shift
+
+if ldapsearch -l 3 -LLL -h $ldapserver -x -b '' -s base > /dev/null 2>&1 ; then
+ echo "OK - Searching for LDAP root DSE worked on $ldapserver"
+ exit 0
+else
+ echo "Failed to fetch root DSE from LDAP server $ldapserver."
+ exit 1
+fi