InfluxDB V2 OSS Alerts : capturing the metric value in notification message

We are monitoring a bunch of IoT Devices using TIG stack and are trying to configure alerts using InfluxDB V2’s inbuilt Alerts feature. We have configured the slack notification channel and we would like to capture the metric value as part of the message. Here is a sample status message template:

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

This shows the alert like this:

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

The actual value is in the field _value , when I try to capture this as part of the message

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

The notification check fails. I read in the documentation that Flux only interpolates string values, I tried to convert the _value to string

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

Still, the notification check fails.

Are we missing something?

Hi RK,
Thank you for posting here about the issue as-well. I have asked one of my colleagues to review the issue and get back to you. I hope we can move forward with this issue later today.

Thanks for your patience,
Jay

1 Like

Hi RK, Thank you for your patience I now have an answer for you. When creating a check the _value field is automatically pivoted . In short this means instead of using the _value field you should use the _field name. For example:
Check: ${ r._check_name } is: ${ r._level } ${string(v: r.used_percent)}
Where by used_percent was the _field name.

I hope this helps. Let me know if you have any further questions

Awesome! this helped, Jay! thanks a lot!

1 Like