edir-version.py 1008 B

12345678910111213141516171819202122232425262728
  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. # (c) Michael Honkoop <mhonkoop@comsolve.nl>
  11. # License: GNU General Public License v2
  12. import subprocess
  13. # The process to be executed
  14. myexec = "ndsd"
  15. # Attempt to execute the process, if successful output CheckMK formatted data, if not return nothing.
  16. try:
  17. output = subprocess.check_output([myexec, "--version"])
  18. output_arr = output.split(' ')
  19. print("0 \"" + output_arr[1] + "\" - Binary Version: " + output_arr[2] + ", DS Version: " + output_arr[3])
  20. except subprocess.CalledProcessError as e:
  21. print("3 \"" + e)
  22. exit()