Alert Replication Status

Hello, I want to create a postgresql replication alert, I have a query that returns “Up” for active and “Down” for inactive, how to make an alert for when the query result is equal to “Down”, I’m using postgresql- 14 and grafana 9.3.2