釘釘機器人通知


#!/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