-
What Grafana version and what operating system are you using?
9.4.13 -
What are you trying to achieve?
I’m triyng to set up an alert rule consisting of 3 querys and a math expression. -
How are you trying to achieve it?
One of the three queries consists the measured values, the second the max values the third the min values. The math expression will compare them and trigger the alerts.
Due to the data structure in InfluxDB Bucket I have to use the join.inner() function within the query. -
What happened?
Error Msg:
Failed to evaluate queries and expressions: input data must be a wide series but got type long (input refid) -
What did you expect to happen?
The series getting displayed in the preview window like when I run those queries on the influxdb data explorer.
- Can you copy/paste the configuration(s) that you are having problems with?
Query1 (Measured Values):
import “join”
AvgValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “Avg”)
|> group(columns: [“_time”])
HystValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “AlarmHyst”)
|> filter(fn: (r) => r[“_value”] == 10)
|> group(columns: [“_time”])
join.inner(
left: AvgValues,
right: HystValues,
on: (l, r) => l.SensorID == r.SensorID,
as: (l, r) => ({l with field1: l._value}),
)
|> group(columns: [“SensorID”])
Query2 (Max Values):
import “join”
AvgValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “AlarmMax”)
|> group(columns: [“_time”])
HystValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “AlarmHyst”)
|> filter(fn: (r) => r[“_value”] == 10)
|> group(columns: [“_time”])
join.inner(
left: AvgValues,
right: HystValues,
on: (l, r) => l.SensorID == r.SensorID,
as: (l, r) => ({l with field1: l._value}),
)
|> group(columns: [“SensorID”])
Query3:
import “join”
AvgValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “AlarmMin”)
|> group(columns: [“_time”])
HystValues = from(bucket: “SmartGraph Sensor Platform”)
|> range(start: -3h)
|> filter(fn: (r) => r[“ValueType”] == “AlarmHyst”)
|> filter(fn: (r) => r[“_value”] == 10)
|> group(columns: [“_time”])
join.inner(
left: AvgValues,
right: HystValues,
on: (l, r) => l.SensorID == r.SensorID,
as: (l, r) => ({l with field1: l._value}),
)
|> group(columns: [“SensorID”])
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
see above
- Did you follow any online instructions? If so, what is the URL?