ZPool-Monitoring, Add script

This commit is contained in:
Michael Höß 2020-09-29 13:06:23 +00:00
parent e489e87f13
commit d82aa42d27
1 changed files with 28 additions and 0 deletions

28
zbx-zpool.bash Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
(C) MH 2018, MIT-License
SRV=""
if [ "$2" != "" ]; then
SRV="-z ${2}"
fi
echo "- zpool.problems \""`zpool list -H | grep -v ONLINE | cut -f 1 | paste -sd ":"`\" | zabbix_sender -i - -c /etc/zabbix/zabbix_agentd.conf $SRV 2>&1 > /dev/null
if [ "$1" != "" ]; then
MISSING=""
IFS=","
for i in $1; do
#echo "X${i}X"
C=`zpool list -H | grep "$i" | wc -l`
if [ "$C" != "1" ]; then
MISSING="${MISSING}${i};"
fi
done
unset IFS
#echo "- zpool.missing \"${MISSING}\"" | logger -t "zabbix-zpool sent"
echo "- zpool.missing \"${MISSING}\"" | zabbix_sender -i - -c /etc/zabbix/zabbix_agentd.conf $SRV 2>&1 > /dev/null
fi