douyuben9434
2017-04-18 13:22
浏览 264
已采纳

Prometheus电子邮件警报以显示指标值

I have a label cs_job_time in Prometheus/Alert Manager and would like to send an email alert when a condition is met for another job. The email sends fine but is it possible to include the value of cs_job_time within the email? I can use {{$value}} for the metric in question but I would also like to print the value of cs_job_time.

I came across this but when I try

time = "{{  `cs_job_time{instance='%s', job='/'}` $labels.instance | query | first }}

or similar variants, I get the error message "Error expanding alert template CSJobAlert with data '{map[] 2123}': runtime error: invalid memory address or nil pointer dereference" source="alerting.go:199"

Is it possible to email metric values?

图片转代码服务由CSDN问答提供 功能建议

我在Prometheus / Alert Manager中具有标签 cs_job_time </ code>,并且想发送电子邮件 在满足另一项工作的条件时发出警报。 电子邮件发送正常,但是是否可以在电子邮件中包含 cs_job_time </ code>的值? 我可以对相关指标使用 {{$ value}} </ code>,但我也想打印 cs_job_time </ code>的值。 </ p>

我遇到了,但是当我 try </ p>

  time =“ {{`cs_job_time {instance ='%s',job ='/'}`$ labels.instance | query | first}} 
 <  / code> </ pre> 
 
 

或类似的变体,我收到错误消息“错误扩展警报模板CSJobAlert并带有数据'{map [] 2123}':运行时错误:无效的内存地址或 nil指针取消引用“ source =” alerting.go:199“ </ code> </ p>

是否可以通过电子邮件发送指标值?</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题