#!/bin/bash
#${webhook}为钉钉机器人地址
webhook='https://oapi.dingtalk.com/robot/send?access_token=34XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
cluster='QQOrder_ERP'
#获取主机Ip地址
host=`hostname -I | awk '{print $1}'`
vip=$1
function SendMsgToDingding() {
curl $webhook -H 'Content-Type: application/json' -d "
{
'msgtype': 'text',
'text': {
'content': '集群名称:$cluster\n告警信息:虚拟IP<$vip>已漂移至节点<$host>,请注意\n'
},
'at': {
'isAtAll': true
}
}"
}
SendMsgToDingding
Shell脚本发送消息到钉钉群
于 2024-10-16 14:38:20 首次发布