zabbix中经过shell脚本进行微信监控告警

经过shell脚本配置经过微信进行告警方式发送:shell

1、在zabbix的发送告警的的目录下新建sendWebChat.shvim

cd  /usr/lib/zabbix/alertscriptsapi

vim  sendWeChat.sh
bash

2、脚本内容(须要企业号的CropID和Secret)微信

#!/bin/bashcurl

# Filename:    sendWeChat.sh
# Revision:    1.0
# Date:          2015/09/08
# Author:      Json
# Description: zabbix微信告警脚本
# Notes:       WeCaht告警
#
CropID=企业号的CropID
ide

Secret=企业号的Secreturl

GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret"
Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F\" '{print $4}')
PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken"
Content=$3
spa

/usr/bin/curl --data-ascii '{ "touser": "@all", "toparty": " @all ","msgtype": "text","agentid": "1","text": {"content": "'${Content}'"},"safe":"0"}' $PURLorm

相关文章
相关标签/搜索