【问题标题】:InfluxDB V2 OSS Alerts : capturing the metric value in notification messageInfluxDB V2 OSS 警报:在通知消息中捕获度量值
【发布时间】:2021-11-11 04:01:08
【问题描述】:

我们正在使用 TIG 堆栈监控一堆 IoT 设备,并尝试使用 InfluxDB V2 的内置警报功能配置警报。我们已经配置了 slack 通知通道,我们希望将度量值作为消息的一部分捕获。这是一个示例状态消息模板:

The memory utilization is *${ r._level }* 
On Device Name: *${ r.host }*
Polled At: *${ r._time}*

这显示了这样的警报:

Memory Alert  The memory utilization is crit
On Device Name: Device-dev-02
Polled At: 2021-09-16T06:41:15.000000000Z

当我尝试将其作为消息的一部分捕获时,实际值在字段_value

The memory utilization is *${ r._level }* 
On Device Name: *${ r.host }*
Polled At: *${ r._time}*
Current Memory: *${ r._value}*

通知检查失败。我在documentation 中读到 Flux 只插入字符串值,我试图将 _value 转换为字符串

The memory utilization is *${ r._level }* 
On Device Name: *${ r.host }*
Polled At: *${ r._time}*
Current Memory: *${string(v: r._value)}*

通知检查仍然失败。

我们错过了什么吗?

【问题讨论】:

    标签: monitoring influxdb-2


    【解决方案1】:

    我能够回答这个问题,thanks to Jay from Influxdata community。在这里发布答案,希望有人会觉得它有用。

    创建支票时,_value 字段会自动旋转。简而言之,这意味着您应该使用_fieldname,而不是使用_value 字段。

    例如:

    Check: ${ r._check_name } is: ${ r._level } ${string(v: r.used_percent)} 
    

    used_percent 是 _field 名称。

    【讨论】:

      猜你喜欢
      • 2017-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多