From d82aa42d273f1cb0e4cd1ec0ce8a051e67014580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20H=C3=B6=C3=9F?= Date: Tue, 29 Sep 2020 13:06:23 +0000 Subject: [PATCH] ZPool-Monitoring, Add script --- zbx-zpool.bash | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 zbx-zpool.bash diff --git a/zbx-zpool.bash b/zbx-zpool.bash new file mode 100644 index 0000000..4fd3a97 --- /dev/null +++ b/zbx-zpool.bash @@ -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