Hi, I have tried everything to create a simple multi dimension alarm.
I am using Grafana 9.06. (Upgraded today).
Running on Ubuntu 20.
I have a bunch of sensors, and can get a query setup but I keep getting this error: invalid format of evaluation results for the alert definition : frame cannot uniquely be identified by its labels: has duplicate results with labels {}
My sensors simply provide a 0 or 1 status. I just want to know if any of them go 1.
My values are:
S083_Q
S084_Q
…
S101_Q
So this query gets this for me: SELECT last(/_Q/) FROM “MACCA” WHERE (“DeviceId” = ‘RTK_000007’) AND $timeFilter GROUP BY time($__interval) fill(previous)
Now I have tried everything but I keep getting that same frame cannot uniquely be identified by its labels: has duplicate results with labels {} error.
I know its something to do with the labels, but how do I set them up?
If i use Math, $A > 0 then I just get this:
If I use Reduce, then I get exactly the same: (I can’t embed another pic.
No matter what I get this error:
State: Error
Info: invalid format of evaluation results for the alert definition : frame cannot uniquely be identified by its labels: has duplicate results with labels {}
Can someone please explqain how to setup a multi dimensional alert with influxdb and InfluxQL - Do I need to use Flux?
The problem is the design of your measurements in influxdb. Its the many fields that is the issue. It would be better if you had one 'field to hold the 0 or 1 value and then use a tag for the sensor locations (S08x_Q)
For multidimensional alerts with influxdb you need to able to group by a tag and it should only have one occurence to ensure unique labels (hence the single field)
If you take the approach i mentioned, its very easy to setup:
add a group by to your influxb query, grouping on the tag holding the S08x values. sets assume that tag is called: location
in the alias by field enter $tag_location
Add a reduce function with Function: last
Done. Alerting alerts on non-null values >0 by default so no need for an additional math expression.
Potentially you can also just set the alert condition directly to the query if you drop the time interval group-by in the query, and format the table as Table instead of Time Series.
Thanks so much for the reply. I’m still a bit confused though.
I have a tag called topic. (Which is what the mqtt comes in on.)
When I do, what I think you said is: I get this:
SELECT /_Q$/ FROM “MACCA” WHERE $timeFilter GROUP BY “topic”
Buty when I use this in an alert, it seems to truncate my topics, and it loses the last section.
And the error:invalid format of evaluation results for the alert definition : frame cannot uniquely be identified by its labels: has duplicate results with labels {topic=rtk/RTK_000007/S083_Q}
Ok, solved it. Thanks for your help.
I changed my data to have a “value” field. and added an SCODE tag for the name.
Like “S083_Q” …
And tehn used a WHERE to filter on regex.
SELECT “value” FROM “MACCA” WHERE (“SCODE” =~ /_Q/) AND $timeFilter GROUP BY “SCODE”