|
@@ -6,25 +6,26 @@
|
|
|
|
|
|
|
|
# Version 0.1:
|
|
# Version 0.1:
|
|
|
# - initial release
|
|
# - initial release
|
|
|
|
|
+# Version 0.2
|
|
|
|
|
+# - adapted state for checking required packages for the check
|
|
|
|
|
|
|
|
# Current active version of the script
|
|
# Current active version of the script
|
|
|
-SCRIPT_VERSION=0.1
|
|
|
|
|
|
|
+SCRIPT_VERSION=0.2
|
|
|
|
|
|
|
|
# Installation:
|
|
# Installation:
|
|
|
-# This file should be placed on a/the host running SimpleSAMLPhp in /usr/lib/check_mk_agent/local
|
|
|
|
|
|
|
+# This file should be placed on a/the host running SimpleSamlPHP in /usr/lib/check_mk_agent/local
|
|
|
#
|
|
#
|
|
|
# (reccomended) if you want the check to run on a different schedule (like once per hour) put it in a subdirectory of above path
|
|
# (reccomended) 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.
|
|
# named to the number of seconds of the interval wanted, so 3600/ for once an hour, 86400/ for once per day.
|
|
|
-# Suggestion for this check is to run this once a day to minimize processing cost, github does not like it when you query every (default)
|
|
|
|
|
-# check-interval, and will return a http 403 -error.
|
|
|
|
|
|
|
+# Suggestion for this check is to run this once a day to minimize processing cost.
|
|
|
#
|
|
#
|
|
|
-# Also do not forget to make this file executable with chmod +x /usr/lib/check_mk_agent/local/simplesaml_version_check.sh
|
|
|
|
|
|
|
+# Also do not forget to make this file executable with chmod +x /usr/lib/check_mk_agent/local/simplesaml_version_check
|
|
|
|
|
|
|
|
##########################################################################
|
|
##########################################################################
|
|
|
# Global definitions for the script - change if needed to fit your needs #
|
|
# Global definitions for the script - change if needed to fit your needs #
|
|
|
##########################################################################
|
|
##########################################################################
|
|
|
|
|
|
|
|
-# Define path to where SimpleSAMLPhp is installed
|
|
|
|
|
|
|
+# Define path to where SimpleSalmPHP is installed
|
|
|
BASEPATH="/opt/simplesamlphp"
|
|
BASEPATH="/opt/simplesamlphp"
|
|
|
|
|
|
|
|
# Version (json) file reference
|
|
# Version (json) file reference
|
|
@@ -43,19 +44,19 @@ SERVICE="SimpleSAMLphp_Version"
|
|
|
|
|
|
|
|
# Check if jq package is present on the system (required for this check)
|
|
# Check if jq package is present on the system (required for this check)
|
|
|
if ! command -v jq >/dev/null 2>&1; then
|
|
if ! command -v jq >/dev/null 2>&1; then
|
|
|
- echo "2 \"$SERVICE\" - $SERVICE localcheck requires jq package to be installed"
|
|
|
|
|
|
|
+ echo "3 \"$SERVICE\" - $SERVICE localcheck requires jq package to be installed"
|
|
|
exit 0
|
|
exit 0
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Check if curl package is present on the system (required for this check)
|
|
# Check if curl package is present on the system (required for this check)
|
|
|
if ! command -v curl >/dev/null 2>&1; then
|
|
if ! command -v curl >/dev/null 2>&1; then
|
|
|
- echo "2 \"$SERVICE\" - $SERVICE localcheck requires curl package to be installed"
|
|
|
|
|
|
|
+ echo "3 \"$SERVICE\" - $SERVICE localcheck requires curl package to be installed"
|
|
|
exit 0
|
|
exit 0
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Check presence of SimpleSAMLPhp and report if not found
|
|
# Check presence of SimpleSAMLPhp and report if not found
|
|
|
if [[ ! -f "$BASEPATH/$VERSION_FILE" ]]; then
|
|
if [[ ! -f "$BASEPATH/$VERSION_FILE" ]]; then
|
|
|
- echo "2 \"$SERVICE\" - No local version information found in: $$BASEPATH/$VERSION_FILE check localcheck configuration."
|
|
|
|
|
|
|
+ echo "3 \"$SERVICE\" - No local version information found in: $$BASEPATH/$VERSION_FILE check localcheck configuration."
|
|
|
exit 0
|
|
exit 0
|
|
|
fi
|
|
fi
|
|
|
# Get installed version information via composer.json or version file
|
|
# Get installed version information via composer.json or version file
|
|
@@ -68,6 +69,7 @@ else
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Get latest avaiable version information from github.
|
|
# Get latest avaiable version information from github.
|
|
|
|
|
+#AVAILABLE_VERSION=$(curl -fsSL -H 'Accept: application/vnd.github+json' --connect-timeout 5 --max-time 15 "$RELEASEURL" | jq -er 'map(select(.draft == false and .prerelease == false)) | .[0].tag_name' | sed 's/^v//')
|
|
|
AVAILABLE_VERSION=$(curl -fsSL -H 'Accept: application/vnd.github+json' --connect-timeout 5 --max-time 15 "$RELEASEURL" | jq -r '.[] | select(.draft == false and .prerelease == false) | .tag_name' | sed 's/^v//' | sort -V | tail -n1)
|
|
AVAILABLE_VERSION=$(curl -fsSL -H 'Accept: application/vnd.github+json' --connect-timeout 5 --max-time 15 "$RELEASEURL" | jq -r '.[] | select(.draft == false and .prerelease == false) | .tag_name' | sed 's/^v//' | sort -V | tail -n1)
|
|
|
# Error handling / Evaluate results
|
|
# Error handling / Evaluate results
|
|
|
if [ -z "$AVAILABLE_VERSION" ]; then
|
|
if [ -z "$AVAILABLE_VERSION" ]; then
|