File: check_ldap_root

package info (click to toggle)
nagios-plugins-contrib 16.20151226~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports-sloppy
  • size: 6,176 kB
  • sloc: perl: 34,103; sh: 17,996; python: 1,883; php: 593; lex: 582; makefile: 441; ansic: 233; ruby: 96; awk: 81
file content (35 lines) | stat: -rwxr-xr-x 727 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
# Author: Petter Reinholdtsen <pere@hungry.com>
# Date: 2011-12-22
# License: GNU GPL v2 or later
#
# 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 type ldapsearch > /dev/null 2>&1 ; then
    :
else
    echo "Missing the ldapsearch tool, unable to check LDAP server."
    exit 2
fi

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