-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修改了模板没有生效 #37
Comments
你用的接口是模板接口:/prometheusalert吗,自定义模板必须对应自定义模板接口才能生效,并且模板的名称不能跟别的模板名称重复
…---原始邮件---
发件人: "imlxh"<[email protected]>
发送时间: 2020年6月28日(周日) 下午3:27
收件人: "feiyu563/PrometheusAlert"<[email protected]>;
抄送: "Subscribed"<[email protected]>;
主题: [feiyu563/PrometheusAlert] 修改了模板没有生效 (#37)
修改了钉钉的模板,但是告警时还是发的老的模板内容,还有如果我想遍历所有label,怎么改模板哈
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
哦哦,用的不是您说的这个接口,但是发现提示是多个告警,发出来的只显示了第一个告警,这个感觉还需要优化下 |
老的接口尚未接入自定义模板,下一版本会接入
…---原始邮件---
发件人: "imlxh"<[email protected]>
发送时间: 2020年6月29日(周一) 上午9:37
收件人: "feiyu563/PrometheusAlert"<[email protected]>;
抄送: "Comment"<[email protected]>;"feiyu563"<[email protected]>;
主题: Re: [feiyu563/PrometheusAlert] 修改了模板没有生效 (#37)
哦哦,用的不是您说的这个接口,但是发现提示是多个告警,发出来的只显示了第一个告警,这个感觉还需要优化下
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
好的,我如果想把所有label都打印出来,模板该怎么设置呢,必须都写出来么 |
参考#30 |
这个我看了,是固定的,并没有展示所有内容,告警比较简练 |
@feiyu563 你好,我在grafana里设置了发告警到 http://PrometheusAlert/grafana/dingding 以下是我从日志中拿到的信息:
请问这里需要如何定制模版呢?是不是文档与代码不同步?多谢 |
这些就是grafana的json
|
|
遍历所有labels的模版试试这个 |
你上面那个是grafana的告警消息,要用grafana的模版,而你用的prometheus的模版 肯定会报错 |
看到了,多谢 |
|
好的,我试下,非常感谢 |
debug后发现是grafana原来设置的模版中包含time方法调用导致的,删除包含time的调用之后就正常了。
与传入的消息转换时没有time对象导致返回 nil 报错,在
|
接收到的Grafana消息为:
对应的 Grafana 告警模版改为:
|
额,这是之前测试时候忘记删除了
…---原始邮件---
发件人: "xmx0632"<[email protected]>
发送时间: 2020年6月30日(周二) 凌晨0:21
收件人: "feiyu563/PrometheusAlert"<[email protected]>;
抄送: "Mention"<[email protected]>;"feiyu563"<[email protected]>;
主题: Re: [feiyu563/PrometheusAlert] 修改了模板没有生效 (#37)
接收到的Grafana消息为:
{"evalMatches":[{"value":0,"metric":"up{Category=\"micro-service\", Env=\"prod\", Name=\"fabric-sidecar-1\", Usage=\"fabric-sidecar\", instance=\"10.170.0.11:9876\", job=\"micro-service\"}","tags":{"Category":"micro-service","Env":"prod","Name":"fabric-sidecar-1","Usage":"fabric-sidecar","__name__":"up","instance":"10.170.0.11:9876","job":"micro-service"}}],"message":"微服务挂了!请联系管理员检查!","ruleId":37,"ruleName":"MicroService节点状态告警","ruleUrl":"http://localhost:3000/d/yCQyX6ZMz/blockchainservicemonitor?fullscreen\u0026edit\u0026tab=alert\u0026panelId=8\u0026orgId=1","state":"alerting","tags":{},"title":"[Alerting] MicroService节点状态告警"}
对应的 Grafana 告警模版改为:
## [Grafana告警信息]({{.ruleUrl}}) #### {{.ruleName}} ###### 告警级别:严重 ##### {{.message}} ##### {{.value}} {{range $i, $v := .evalMatches}} {{ if $v.tags.Category }} ##### Category: {{ $v.tags.Category }} {{end}} {{ if $v.tags.Usage }} ##### Usage: {{ $v.tags.Usage }} {{end}} {{ if $v.tags.instance }} ##### Instance: {{ $v.tags.instance }} {{end}} {{end}}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
issue我先关闭了 |
我能不能只填写模板地址,不填写其它配置,让它从 |
我使用sqlite3连数据库都改了,使用默认的接口还是不生效。 这个默认的告警模板是写死在代码里面的了吗?我连数据库都改了,哎! |
+1 搞了半天,发现白忙活一场 |
修改了钉钉的模板,但是告警时还是发的老的模板内容,还有如果我想遍历所有label,怎么改模板哈
The text was updated successfully, but these errors were encountered: