钉钉机器人通知


#!/bin/bash

webhook='https://oapi.dingtalk.com/robot/send?access_token=34XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
GX='更新服务'
host=`hostname -I | awk '{print $1}'`
ZT=$1

function SendMsgToDingding() {
    curl $webhook -H 'Content-Type: application/json' -d "
    {
        'msgtype': 'text',
        'text': {
            'content': '$GX\n操作服务器:IP$host 状态是否成功:$ZT\n'
        },
        'at': {
            'isAtAll': false
        }
    }"
}


SendMsgToDingding
curl 'https://oapi.dingtalk.com/robot/send?access_token=addasdxxxx'  -H "Content-Type:application/json"  -d "{\"msgtype\": \"text\", 
    \"text\": {
        \"content\": \"服务器异常a,请快速处理下\"
    }, 
    \"at\": {
        \"atMobiles\": [
            \"183xxx50xx\", 
        ], 
        \"isAtAll\": false
    }
}"

遇到的问题

{"errcode":300001,"errmsg":"message param title is null "} 需要添加 增加at参数

自定义机器人开发:https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq
shell 操作钉钉机器人实现告警提醒: https://www.cnblogs.com/xuliuzai/p/11469039.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM