Fixed generic monitor check ZFS_POOL_CHECK

This commit is contained in:
m8in
2026-06-15 20:33:52 +02:00
parent 5136cfc24d
commit b6fe890e74
+3 -2
View File
@@ -5,7 +5,7 @@ base.loadModule ssh
function testPool(){ function testPool(){
local _RESPONSE=$(ssh.onHostRun "monitoring@${1:?"Missing REMOTE_HOST"}" 'zpool status ${_ZFS_POOL} | grep -F scrub') local _RESPONSE=$(ssh.onHostRun "monitoring@${1:?"Missing REMOTE_HOST"}" "zpool status ${2:?"Missing REMOTE_POOL"} | grep -F scrub")
local _RESULT=$(echo "${_RESPONSE}" | grep -F 'scrub repaired 0B' | grep -F '0 errors') local _RESULT=$(echo "${_RESPONSE}" | grep -F 'scrub repaired 0B' | grep -F '0 errors')
_RESULT="${_RESULT#*on}" #Removes shortest matching pattern '*on' from the begin _RESULT="${_RESULT#*on}" #Removes shortest matching pattern '*on' from the begin
@@ -18,6 +18,7 @@ function testPool(){
} }
base.set REMOTE_HOST "${1:?"FQDN of server missing: e.g. host.example.net[:port]"}" '^([a-zA-Z0-9][a-zA-Z0-9.-]*)+(:[0-9]+)?$' base.set REMOTE_HOST "${1:?"FQDN of server missing: e.g. host.example.net[:port]"}" '^([a-zA-Z0-9][a-zA-Z0-9.-]*)+(:[0-9]+)?$'
testPool "${REMOTE_HOST}" && exit 0 base.set REMOTE_POOL "${2:?"Missing name of zpool: e.g. zpool1"}" '^[a-zA-Z0-9_-]+$'
testPool "${REMOTE_HOST}" "${REMOTE_POOL}" && exit 0
exit 1 exit 1