What Grafana version and what operating system are you using? 8.3.1 SLES
What are you trying to achieve?
I have many simple alerts in grafana 8 (still legacy alerting) running fine. But I fell into trouble with something that should be fairly simple.
I need to fire an alert when there is a difference between current and previous value (for any value in serie) above threshold. Data are put daily at night (time is only yyyy-mm-dd)
consider dataset ajnd threshold:
2021-01-11 ABC 123
2021-01-11 DEF 455
2021-01-12 ABC 100
2021-01-12 DEF 452
So the alert should be fired on ABC value in serie. Right after pulling it into DB.
- How are you trying to achieve it?
$__timeGroup(time,‘1h’, previous) as time,
(ABS(LAG(DataMB,1,0) OVER (PARTITION BY location ORDER BY TIME) - DataMB))/(LAG(DataMB,1,0) OVER (PARTITION BY location ORDER BY TIME))*100 AS diffPerc
WHERE $__timeFilter(time) AND location IS NOT NULL
ORDER BY TIME, location
values are calculated correctly
- What happened?
- What did you expect to happen?
Send an alert at night right after importing data into DB
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
It is a puzzle for myself. Probably something easy is missing but I have no clue what could it be.
If I test the rule I get in querry result NULL for any of 25 hour datapoints. If I change querry to timegroup 24h still nulls.