mirror of
https://github.com/m8tin/cis.git
synced 2026-06-02 22:57:20 +02:00
24 lines
711 B
Bash
Executable File
24 lines
711 B
Bash
Executable File
#!/bin/bash
|
|
source /cis/core/base.module.sh
|
|
base.loadModule ssh
|
|
|
|
|
|
|
|
function testPool(){
|
|
local _RESPONSE=$(ssh.onHostRun "monitoring@${1:?"Missing REMOTE_HOST"}" 'zpool status ${_ZFS_POOL} | grep -F scrub')
|
|
local _RESULT=$(echo "${_RESPONSE}" | grep -F 'scrub repaired 0B' | grep -F '0 errors')
|
|
_RESULT="${_RESULT#*on}" #Removes shortest matching pattern '*on' from the begin
|
|
|
|
[ -z "${_RESULT}" ] \
|
|
&& echo "FAIL#CHECK POOL: ${_ZFS_POOL}" \
|
|
&& return 0
|
|
|
|
echo "OK#Scrubbed on ${_RESULT}."
|
|
return 0
|
|
}
|
|
|
|
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
|
|
|
|
exit 1
|