Concurrent disk monitoring alarm messages

#!/bin/sh
#auto disk monitor
#by zkg 2019-07-15

echo -e "\033[32m \033[1m"
rm -rf list.txt
LIST=df -h|grep "^/dev/" >> list.txt
cat << EOF

---------------- -------------- disk monitoring alarm

EOF
echo -e "\033[32m \033[0m"
sleep 2

WEEK=date +%u
TIME=date

Line the Read the while
do
IP_ADDR = ifconfig eth1|grep "Bcast"|awk '{print $2}'|awk -F: '{print $2}'
D_NAME = echo $line|awk '{print $1,$NF"分区"}'
D_TOTAL = echo $line|awk '{print $2}'
D_AVAIL = echo $line|awk '{print $4}'
D_PERCENT = echo $line|awk '{print $5}'|sed 's/%//g'
IF [ "$ D_PERCENT" -ge 50]; the then
CAT> email.txt << EOF
* EMAIL *****
notification types: Alarm
Services: Disk Monitor
Host : $ IP_ADDR
status: alarm
date / time:
echo "Week $ WEEK $ tIME"
additional information:
CRITICAL in - the MONITOR DISK: $ D_NAME More Used Within last $%} {D_PERCENT
the EOF
echo -e "\ 033 [32mthe $ D_NAME has been Used More Within last $ {D_PERCENT for%}, Please Check ..... \ 033 [0m "
mail -s" $ D_NAME warning "[email protected] <email.txt
Fi

done <list.txt
echo -e "\033[32m---------------------------------------------\033[0m"
echo "Done."

Guess you like

Origin blog.51cto.com/1009516/2425814