Centos 7 下监控与告警部署

微信消息自动推送

注册企业微信

企业微信地址:https://work.weixin.qq.com

注意:上面我只是做个范例,我实际是有自己的企业微信的,下面的企业微信配置和上面的企业微信名称对不上,不要诧异

配置企业微信

 

创建消息应用

消息接口检测

应用接口检测地址:https://work.weixin.qq.com/api/devtools/devtool.php

创建接口脚本

#!/bin/bash
CropID="ww12214570ab5fbcb9"
Secret="m9ppA-DEVz6O5eP3xp51JSrHuFoyJsR2YDl05KJXJR4"
GURL="https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CropID&corpsecret=$Secret"
Gtoken=$(/usr/bin/curl -s -G $GURL | awk -F" '{    print $10}')
PURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Gtoken"
IP=$(curl ip.cip.cc)
/usr/bin/curl --data '{ "touser": "LiangXiao","msgtype": "text","agentid": "1000002","text": {"content": "'$IP'"},"safe":"0"}' $PURL
View Code
原文地址:https://www.cnblogs.com/guge-94/p/10429314.html