1
0

edir-version.sh 993 B

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