Have you tried using Prometheus? Prometheus has a built-metric called up{}
where every time it scrapes an endpoint, it returns 1 for up and 0 for down.
You should also check out loki for status codes:
https://play.grafana.org/d/T512JVH7z/loki-nginx-service-mesh-json-version?orgId=1