edir-version.sh 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. #
  3. # (c) Michael Honkoop <mhonkoop@comsolve.nl>
  4. # License: GNU General Public License v2
  5. # Version 0.1 : Initial release
  6. # Version 0.2 : Updated structure and status reporting when prerequisites are not met.
  7. #
  8. SCRIPTVERSION=0.2
  9. # A similar check is available in this repository written in python (edir-version.py)
  10. #
  11. # This check should be placed in /usr/lib/check_mk_agent/local and made executable with `chmod +x edir-version.sh`
  12. # Servicename to show in CheckMK
  13. SERVICE="ndsd"
  14. # Check if ndsd is present on the system, if not then report it.
  15. # This assumes that you have exported the environment variables when installing eDirectory
  16. if ! command -v "$SERVICE" >/dev/null 2>&1; then
  17. echo "3 \"$SERVICE\" - $SERVICE executable was not found."
  18. exit 0;
  19. fi
  20. # Execute command to retrieve information
  21. VersionInfo=$(ndsd --version)
  22. # Output formatted information to CheckMK
  23. echo "0 \"$(echo $VersionInfo | awk '{ print $2 }')\" - Binary Version $(echo $VersionInfo | awk '{ print $3 }'), DS Version $(echo $VersionInfo | awk '{ print $4 }')"
  24. exit 0;