I am having a similar issue with Prometheus Data Source
I am trying to set an alert on the memory usage of the Kubernetes pod if it breaches 80 percent.
I have 2 queries, one returning the data of the current usage and the other query returning the resource limit, see below
Query A is getting data from Prometheus cAdvisor:
Query B is getting data from Prometheus kube-state-metrics
I have reduced the query results using reduce functions to get the last values, see below
My desired result is to be able to calculate the usage percentage from Expressions C and D, and then use a threshold Expression to check if it breached 80 percent, but that doesn’t work in the case of multidimensional Queries, it results in no data
Options Explored
Option 1:
Calculating 80 percent value from Expression D using math Expression in Panel E and then using Threshold Expression on Expression C to check if it breached the value attained from Expression E.
Drawback/Blocker:
Unable to dynamically use the result from Expression E in Threshold Expression, as I want this calculation to be on the fly, instead of manually entering the value.
The reason I want this to be done dynamically is that I am using Terraform provider to provision my alerts as per my team’s requirement and use-case.
Option 2:
Using a Math Expression to check if values from Expression C are Greater than values from Expression E, See below:
Drawback/Blocker:
Again this results in No data as the math expression is not working with multidimensional queries
Environment:
Grafana Version: 9.3.6
Data source type & version: Prometheus
User OS & Browser: MacOS/Chrome