首页 > 微信 > 详细

zabbix微信报警

时间:2019-07-09 16:18:54      阅读:130      评论:0      收藏:0      [点我收藏+]
技术分享图片
 1 #!/bin/env bash 
 2 #set -x 
 3 CorpID="ww0597fbc0e83ed529" #企业ID 
 4 Secret="BQtxvc7qGV_I6FrmnA8LOaUWwfUC1ppYbwVwPrllxFU" #应用的Secret 
 5 GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CorpID&corpsecret=$Secret" 
 6 Token=$(/usr/bin/curl -s -G $GURL |awk -F ":" {print $4}|awk -F \" ‘{print $2}‘) 
 7 echo $Token 
 8 PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Token" 
 9 UserID="@all" #成员ID列表 
10 #PartyID=1 #部门ID 
11 agentid=1000002 #企业应用的ID
12 Msg=$@
13 Msg=`echo ${Msg} | sed $s/\"//g`
14 message(){
15     printf {\n 
16     printf \t"touser": "‘"$UserID"\"",\n" 
17   #  printf \t"toparty": "‘"$PartyID"\"",\n" 
18     printf \t"msgtype": "text",\n 
19     printf \t"agentid": "‘"$agentid"\"",\n" 
20     printf \t"text": {\n 
21     printf \t\t"content": "‘"${Msg}"\""\n" 
22     printf \t},\n 
23     printf \t"safe":"0"\n 
24     printf }\n 
25     }
26 /usr/bin/curl --data-ascii "$(message)" $PURL
View Code

 

zabbix微信报警

原文:https://www.cnblogs.com/linglingling/p/11158041.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!