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