1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #!/bin/bash
adr=`/usr/sbin/ip addr | grep '172.17' | awk '{print $2}' | tail -n 1`
/bin/df -h | grep '9[0-9]%' if [ $? = 0 ];then dir=`/bin/df -h | grep '9[0-9]%' | awk '{print $NF}' | head -n 1` usg=`/bin/df -h | grep '9[0-9]%' | awk '{print $(NF-1)}' | head -n 1` curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'瑞金本地化云服服务器'\n'DiskWarn'\n'IP:${adr}'\n'Directory:${dir}'\n'Usage:${usg}'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/f9e39c63-0bd9-4e54-a35e-2cb50931be56 fi
/bin/df -h | grep '100%' if [ $? = 0 ];then dir=`/bin/df -h | grep '100%' | awk '{print $NF}' | head -n 1` usg=`/bin/df -h | grep '100%' | awk '{print $(NF-1)}' | head -n 1` curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'瑞金本地化云服服务器'\n'DiskWarn'\n'IP:${adr}'\n'Directory:${dir}'\n'Usage:${usg}'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/f9e39c63-0bd9-4e54-a35e-2cb50931be56 fi
|