[Localcheck] Fusionauth version checker

Hi all,

As most admins the issue is to make updates of applications visible in your monitoring which are outside of the package-manager’s scope.

So every once in a while when i have the time i create a localcheck for an application which i want to have monitored regarding version (in my running env).

Today i am sharing a version-check for FusionAuth so it can be monitored in CMK.

The current check assumes a Linux *.rpm -based setup (as i have) , but planning to extend it to also handle a *.deb style in the future.
Currently not planning for a Windows-implementation, as i do not run windows(-servers) to run stuff.

#!/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-version.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
  • Glowsome

PS,

Updates to this LocalCheck will be posted on my Personal Git Instance