Pārlūkot izejas kodu

Updated localchecks/directadmin.sh to v0.6

Added logic to also detect extension updates
Michael Honkoop 4 dienas atpakaļ
vecāks
revīzija
f042f881bc
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      localchecks/directadmin.sh

+ 9 - 1
localchecks/directadmin.sh

@@ -14,9 +14,11 @@
 # - Added check for DirectAdmin Core => Rediscovery is required if you had a previous version installed !
 # Version 0.5:
 # - Updates status to be reported in CheckMK when prerequisites are missing.
+# Version 0.6:
+# - Added logic to also detect extension updates
 
 # Current active version of the script
-SCRIPT_VERSION=0.5
+SCRIPT_VERSION=0.6
 
 # Installation:
 # This file should be placed on a/the DirectAdmin host in /usr/lib/check_mk_agent/local
@@ -96,7 +98,13 @@ while read -r line; do
         if [[ "$(printf '%s\n%s\n' "$installed" "$latest" | sort -V | head -n1)" != "$latest" ]]; then
             updates+=("$component")
         fi
+    # Check for PHP extension updates
+    elif [[ "$line" =~ ^(.+)[[:space:]]PHP[[:space:]]([0-9.]+)[[:space:]]extension[[:space:]].*[[:space:]]to[[:space>
+        component="${BASH_REMATCH[1]}"
+        php_version="${BASH_REMATCH[2]}"
+        updates+=("$component PHP $php_version")
     fi
+
 done <<< "$DirectAdmin_Versions_Update"
 
 # Report findings back to CheckMK