vim /usr/lib/zabbix/alertscripts/zabbix_feishu_alarm.py
import requests
import json
import sys
if name == 'main': subject = sys.argv[1] content = sys.argv[2] # payload_message = { "msg_type": "interactive", "card": { "config": { "wide_screen_mode": True, "enable_forward": True }, "elements": [{ "tag": "div", "text": { "content": content, "tag": "lark_md" } }, ], "header": { "title": { "content": subject, "tag": "plain_text" } } } } headers = { 'Content-Type': 'application/json' } url = "https://open.feishu.cn/open-apis/bot/v2/hook/3b883332-3a85-45ca-adab-cffbd98c09a5" # lwl response = requests.request("POST", url, headers=headers, data=json.dumps(payload_message)) print(response)管理-->报警媒介类型-->创建-->配置名称/脚本名称/参数等
{ALERT.SUBJECT} 标题 {ALERT.MESSAGE}信息, 在动作里定义
配置-->动作-->xxxx告警-->操作-->仅送到, 配置所有/飞书原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。