fusionauth-version.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # Version 0.1 - initial start of this localcheck
  3. # Installation
  4. # This file should be place on a/the fusionauth host in /usr/lib/check_mk_agent/local
  5. #
  6. # (optional) if you want the check to run on a different schedule (like once per hour) put it in a subdirectory of above path
  7. # named to the number of seconds of the interval wanted, so 3600/ for once an hour, 86400 for once per day.
  8. #
  9. # Also do not forget to make this file executable with chmod +x /usr/lib/check_mk_agent/local/fusionauth.sh
  10. # (c) Michael Honkoop <mhonkoop@comsolve.nl>
  11. # License: GNU General Public License v2
  12. RELEASEURL="https://license.fusionauth.io/api/latest-version"
  13. FUSIONAUTH_VERSION_AVAIL=$(curl -s --connect-timeout 5 --fail-with-body $RELEASEURL)
  14. if [ -z "$FUSIONAUTH_VERSION_AVAIL" ];
  15. then
  16. echo "1 \"FusionAuth\" - No data received from release-URL, can not determine latest release-version"
  17. exit 0
  18. fi
  19. mapfile -t fusionauth_packages < <(rpm -qa 'fusionauth*')
  20. outdated_packages=()
  21. for package in "${fusionauth_packages[@]}"; do
  22. if [[ "$package" != *"$FUSIONAUTH_VERSION_AVAIL"* ]]; then
  23. outdated_packages+=("$package")
  24. fi
  25. done
  26. if [ ${#outdated_packages[@]} -eq 0 ]; then
  27. echo "0 \"FusionAuth\" - All FusionAuth packages are up to date ($FUSIONAUTH_VERSION_AVAIL)"
  28. else
  29. echo "1 \"FusionAuth\" - Update required for: ${outdated_packages[*]}"
  30. fi