1
0

edir-version.py 920 B

123456789101112131415161718192021222324
  1. #!/usr/bin/python
  2. #
  3. # Version 0.1
  4. #
  5. # Initial release of localcheck in python to get version information of ndsd
  6. # A similar check is available in this repository written in bash (edir-version.sh)
  7. #
  8. # This check should be placed in /usr/lib/check_mk_agent/local and made executable with `chmod +x edir-version.py`
  9. # The script assumes that you have exported the environment variables when installing eDirectory, if not it will fail/not get detected on discovery.
  10. import subprocess
  11. # The process to be executed
  12. myexec = "ndsd"
  13. # Attempt to execute the process, if successful output CheckMK formatted data, if not return nothing.
  14. try:
  15. output = subprocess.check_output([myexec, "--version"])
  16. output_arr = output.split(' ')
  17. print("0 \"" + output_arr[1] + "\" - Binary Version: " + output_arr[2] + ", DS Version: " + output_arr[3])
  18. except subprocess.CalledProcessError as e:
  19. print("3 \"" + e)
  20. exit()