#!/bin/bash#set -xCorpID="xxxxxx"Secret="yyyyy"GETURL=https://qyapi.weixin.qq.com/cgi-bin/gettoken\?corpid=$CorpID\&corpsecret=$SecretToken=$(/usr/bin/curl -s -G $GETURL |awk -F\": '{print $4}'|awk -F\" '{print $2}')#echo $TokenPOSTURL="https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$Token"UserID=$1PartyID=2agentid=2Msg=`echo "$@" | cut -f 3`message(){    printf '{\n'    printf '\t"touser": "'"$UserID"\"",\n"    printf '\t"toparty": "'"$PartyID"\"",\n"    printf '\t"msgtype": "text",\n'    printf '\t"agentid": "'"$agentid"\"",\n"    printf '\t"text": {\n'    printf '\t\t"content": "'"$Msg"\""\n"    printf '\t},\n'    printf '\t"safe":"0"\n'    printf '}\n'}/usr/bin/curl --data-ascii "$(message $1 $2 $3)" $POSTURL

基本上是复制而来,有些地方稍稍修改了下,微信告警正常