diff --git a/README.md b/README.md index c0ce57022ee45d14c4bb1977b3b149576672969c..4baa6a321edc03e85afb55af322601ca21193d5f 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,33 @@ instanceName="" proxyDomainName="login.elixir-czech.org" </pre> +### ldap_status.sh +This script checks if the LDAP servers are accessible + +* Requirements: + * library *ldap-utils* + <pre> + apt-get install ldap-utils + </pre> +* Attributes to be filled: + <pre> + # LDAP username + user="" + + # LDAP password + password="" + + # Base dn of LDAP tree + basedn="" + + # eduPersonPrincipalName which will be searched + searchedIdentity="" + + # List of LDPA hostnames separated by space + # Included ldap:// or ldaps:// + hostnames="" + </pre> + ## List of plugins Plugins are located in /usr/lib/check_mk/plugins/ diff --git a/ldap_status.sh b/ldap_status.sh new file mode 100755 index 0000000000000000000000000000000000000000..ef18c7381d5585536ccc393ccfdd1057ea8eab7b --- /dev/null +++ b/ldap_status.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# LDAP username +user="" + +# LDAP password +password="" + +# Base dn of LDAP tree +basedn="" + +# eduPersonPrincipalName which will be searched +searchedIdentity="" + +# List of LDPA hostnames separated by space +# Included ldap:// or ldaps:// +hostnames="" + +for hostname in $hostnames +do + if [[ -z $password ]]; then + ldapresult=$(ldapsearch -x -H $hostname -b $basedn "(eduPersonPrincipalNames=$searchedIdentity)" 2>&1) + else + ldapresult=$(ldapsearch -x -H $hostname -D $user -w $password -b $basedn "(eduPersonPrincipalNames=$searchedIdentity)" 2>&1) + fi + result=$? + if [[ $result == 0 ]]; then + echo "0 ldap_status-$hostname - OK" + else + echo "2 ldap_status-$hostname - $ldapresult" + fi +done