What happened:I created an alert on one of the dashboards but it giving the error
ALERTING
Error: tsdb.HandleRequest() response error &{invalid: error @1:17-1:23: undefined identifier Bucket A <nil> [] [] 0xc000ebef60}
Feb 18, 2021 08:48:01
PENDING
Error: tsdb.HandleRequest() response error &{invalid: error @1:17-1:23: undefined identifier Bucket A <nil> [] [] 0xc000b13e90}
Feb 18, 2021 07:12:01
What you expected to happen : I expected to get the alert on my email after one hour or specified time period.
How to reproduce it (as minimally and precisely as possible) :
I have used Influx DB 2.0 as data source and used flux query for creating the dashboards and set up the alert for it. I have used the variable in my flux query.
Anything else we need to know? :
Query is running fine and its updating the values as well.
Environment :
- Grafana version: 7.4.0
- Data source type & version: InfluxDB 2.4.0
- OS Grafana is installed on: Docker Image
- User OS & Browser: Windows 10 and Mozilla firefox
I am mentioning my Influxdb flux query as well.
from(bucket: "${Bucket}")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "cu_kpi")
|> filter(fn: (r) => r["_field"] == "field_provided")
|> aggregateWindow(every: 24h, fn: last, createEmpty: false)
|> yield(name: "last")
from(bucket: "${Bucket}")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "cu_kpi")
|> filter(fn: (r) => r["_field"] == "field_provided")
|> aggregateWindow(every: 1s, fn: last, createEmpty: false)
|> yield(name: "last")
Annotations you can see it showing on Grafana dashboard panel.
Same here :
Grafana : v8.1.1 (90c87a52f7)
Datasource : MS SQL
Alerting : Webhook
When using a variable in the query WHERE clause
point IN(${varname})
the grafana log shows lines lik this
t=2021-08-17T09:34:33+0000 lvl=eror msg="Alert Rule Result Error" logger=alerting.evalContext ruleId=1 name="Trending Server 1 alert" error="request handler response error {db query error: mssql: Incorrect syntax near '{'. A 0xc0014a5770 [] [] 0xc001412990}" changing state to=alerting
t=2021-08-17T09:34:35+0000 lvl=eror msg="Alert Rule Result Error" logger=alerting.evalContext ruleId=1 name="Trending Server 1 alert" error="request handler response error {db query error: mssql: Incorrect syntax near '{'. A 0xc001616f00 [] [] 0xc001413bf0}" changing state to=alerting
t=2021-08-17T09:34:37+0000 lvl=eror msg="Alert Rule Result Error" logger=alerting.evalContext ruleId=1 name="Trending Server 1 alert" error="request handler response error {db query error: mssql: Incorrect syntax near '{'. A 0xc0018164c0 [] [] 0xc001441050}" changing state to=alerting
When I remove the variable and replace it with a fixed value that exists and has data
point IN('VALID VALUE')
Grafana logging is like this
t=2021-08-17T09:39:53+0000 lvl=info msg="New state change" logger=alerting.resultHandler ruleId=1 newState=ok prev state=alerting
t=2021-08-17T09:39:53+0000 lvl=info msg="Sending webhook" logger=alerting.notifier.webhook
t=2021-08-17T09:40:33+0000 lvl=info msg="New state change" logger=alerting.resultHandler ruleId=1 newState=pending prev state=ok
t=2021-08-17T09:40:39+0000 lvl=info msg="New state change" logger=alerting.resultHandler ruleId=1 newState=alerting prev state=pending
t=2021-08-17T09:40:39+0000 lvl=info msg="Sending webhook" logger=alerting.notifier.webhook