mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 15:58:26 +01:00
First GENERIC check...
This commit is contained in:
26
script/monitor/checks/GENERIC_ZFSPOOL_USAGE_CHECK.sh
Executable file
26
script/monitor/checks/GENERIC_ZFSPOOL_USAGE_CHECK.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERVER="${1:?"FQDN of server missing"}"
|
||||
|
||||
function testSpace(){
|
||||
local _RESULT=$(/sbin/zpool list -H -o capacity,name | /usr/bin/sort)
|
||||
local _SPACE_USED=$(echo "${_RESULT}" | /usr/bin/tail -n 1 | /usr/bin/cut -f1)
|
||||
local _POOL=$(echo "${_RESULT}" | /usr/bin/tail -n 1 | /usr/bin/cut -f2)
|
||||
|
||||
[ -z "${_SPACE_USED}" ] \
|
||||
&& echo "FAIL#NO value" \
|
||||
&& return 0
|
||||
|
||||
[ "${1:?"Missing OK_THRESHOLD"}" -ge "${_SPACE_USED%\%*}" ] \
|
||||
&& echo "OK#${_SPACE_USED} used ${_POOL}." \
|
||||
&& return 0
|
||||
|
||||
[ "${2:?"Missing INFO_THRESHOLD"}" -ge "${_SPACE_USED%\%*}" ] \
|
||||
&& echo "INFO#${_SPACE_USED} already used ${_POOL}." \
|
||||
&& return 0
|
||||
|
||||
echo "FAIL#${_SPACE_USED} used ${_POOL}!"
|
||||
return 0
|
||||
}
|
||||
|
||||
testSpace 80 90
|
||||
Reference in New Issue
Block a user