|
|
@@ -10,9 +10,11 @@
|
|
|
# - adapted state for checking required packages for the check
|
|
|
# Version 0.3
|
|
|
# - changed output to CheckMK regarding version information when no update available.
|
|
|
+# Version 0.4
|
|
|
+# - updated/aligned comments and added more (descriptive) comments to routines
|
|
|
|
|
|
# Current active version of the script
|
|
|
-SCRIPT_VERSION=0.3
|
|
|
+SCRIPT_VERSION=0.4
|
|
|
|
|
|
# Installation:
|
|
|
# This file should be placed on a/the host running SimpleSamlPHP in /usr/lib/check_mk_agent/local
|
|
|
@@ -65,6 +67,7 @@ fi
|
|
|
# Get installed version information via composer.json or version file
|
|
|
if [ -f "$BASEPATH/$VERSION_FILE" ]; then
|
|
|
INSTALLED_VERSION=$(jq -r '.version // empty' "$BASEPATH/$VERSION_FILE")
|
|
|
+ # Strip leading 'v' from retrieved version information
|
|
|
INSTALLED_VERSION="${INSTALLED_VERSION#v}"
|
|
|
else
|
|
|
# Fallback to checking directory name if version isn't in composer.json
|
|
|
@@ -76,11 +79,11 @@ AVAILABLE_VERSION=$(curl -fsSL -H 'Accept: application/vnd.github+json' --connec
|
|
|
|
|
|
# Error handling / Evaluate results
|
|
|
if [ -z "$AVAILABLE_VERSION" ]; then
|
|
|
- # Issue Warn state when failing to fetch data from GitHub.
|
|
|
+ # Set WARN state when failing to fetch data from GitHub.
|
|
|
echo "1 \"$SERVICE\" - Could not fetch the latest version from GitHub API."
|
|
|
exit 0
|
|
|
elif [ "$VERSION_FILE" = "Unknown" ]; then
|
|
|
- # Issue Warn state when local/installed version could not be determined.
|
|
|
+ # Set WARN state when local/installed version could not be determined.
|
|
|
echo "1 \"$SERVICE\" - Cannot detect installed version in $VERSION_FILE."
|
|
|
exit 0
|
|
|
elif [ "$INSTALLED_VERSION" = "$AVAILABLE_VERSION" ]; then
|
|
|
@@ -88,7 +91,7 @@ elif [ "$INSTALLED_VERSION" = "$AVAILABLE_VERSION" ]; then
|
|
|
echo "0 \"$SERVICE\" - SimpleSAMLphp is up to date ($AVAILABLE_VERSION)."
|
|
|
exit 0
|
|
|
else
|
|
|
- # WARN: Update available
|
|
|
+ # Set WARN state when an update is available
|
|
|
echo "1 \"$SERVICE\" - Update available! Installed: $INSTALLED_VERSION, Available: $AVAILABLE_VERSION."
|
|
|
exit 0
|
|
|
fi
|