企业微信发送消息
#!/bin/bash
wx(){
#将下面的webhook地址替换成你的企业微信机器人地址,$1为告警消息 $2为@人的手机号 $2可以为空
cat > $0.msg << EOF
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=0c562521-7cea-4436-a565-b8080ccb61b4' \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "$2",
"mentioned_mobile_list":["$1"]
}
}'
EOF
sh $0.msg && rm -rf $0.msg
}
wx "$1" "$2"