dingtalk use markdown

This commit is contained in:
Ulric Qin 2021-12-17 11:05:15 +08:00
parent b452be880b
commit b62a42bed8
2 changed files with 11 additions and 10 deletions

View File

@ -105,9 +105,10 @@ class Sender(object):
for t in tokens: for t in tokens:
url = "https://oapi.dingtalk.com/robot/send?access_token={}".format(t) url = "https://oapi.dingtalk.com/robot/send?access_token={}".format(t)
body = { body = {
"msgtype": "text", "msgtype": "markdown",
"text": { "markdown": {
"content": payload.get('tpls').get("dingtalk.tpl", "dingtalk.tpl not found") "title": "n9e notice",
"text": payload.get('tpls').get("dingtalk.tpl", "dingtalk.tpl not found")
}, },
"at": { "at": {
"atMobiles": phones.keys(), "atMobiles": phones.keys(),

View File

@ -1,7 +1,7 @@
级别状态: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}} **级别状态**: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}}
规则名称: {{.RuleName}}{{if .RuleNote}} **规则标题**: {{.RuleName}}{{if .RuleNote}}
规则备注: {{.RuleNote}}{{end}} **规则备注**: {{.RuleNote}}{{end}}
监控指标: {{.TagsJSON}} **监控指标**: {{.TagsJSON}}
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}} {{if .IsRecovered}}**恢复时间**{{timeformat .LastEvalTime}}{{else}}**触发时间**: {{timeformat .TriggerTime}}
触发时值: {{.TriggerValue}}{{end}} **触发时值**: {{.TriggerValue}}{{end}}
发送时间: {{timestamp}} **发送时间**: {{timestamp}}