- Grafana version: 8.3.3
- Visualization: Stat
- Data source type & version: Microsoft SQL Server 2019
- OS Grafana is installed on: Windows
- User OS & Browser: Edge
I’m using variations of the following query to display the health status of an application. I’m also taking advantage of the time series feature that automatically maps the third parameter (metric) to the name assigned to the second parameter (healthy).
When there is data this mostly works as you can see.
When there is no data both the first and the second parameter are shown.
Ideally I’d like to display the health status of an application with no data as unhealthy.
I get the feeling that I need to implement this another way because if there’s no data Grafana can’t know the name of the metric?
SELECT $__timeEpoch(AUDIT_TIME),
CAST(HEALTHY AS INT) AS healthy,
APP_NAME AS metric
FROM ima.dbo.HEALTH_CHECK_RULE
INNER JOIN ima.dbo.HEALTH_CHECK_METRIC m ON HEALTH_CHECK_RULE.RULE_ID = m.RULE_ID
WHERE $__timeFilter(AUDIT_TIME)
AND APP_NAME = 'mwproxy'
AND RULE_NAME = 'All checks'
ORDER BY AUDIT_TIME ASC