kube event 事件监控

阿里云 事件监控开源项目地址
https://github.com/AliyunContainerService/kube-eventer

需要对一下变量进行修改
--sink=dingtalk:[your_webhook_url]&label=[your_cluster_id]&level=[Normal or Warning(default)]

说明
your_cluster_id 字段用于钉钉的自定义关键词

python 钉钉 测试

import json
import requests
url = "https://oapi.dingtalk.com/robot/send?access_token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
header = {
    "Content-Type": "application/json",
    "charset": "utf-8"
    }
data = {
     "msgtype": "text",
     "text": {
            "content": "Newhope告警测试"
        },
     "at": {
            "isAtAll": True   # at为非必须
         }
    }

if __name__ == "__main__":
    sendData = json.dumps(data)
    request = requests.post(url, data=sendData, headers=header)
    print(request.text)
posted @ 2020-01-06 11:01  hurz  阅读(611)  评论(0编辑  收藏  举报