Monitoring endpoint without authorization

When you call https://hass-ip/api/ you get a {"message": "API running."} message returned. This is useful for monitoring and health checks.

The problem is that the entire API needs authentication when you enable it. This breaks easy health check tools.

Can we have a /ping or /healthcheck endpoint that is NOT authenticated, and that gives a predictable result when hass is running? It should just return something simple, and a 2xx if everything is working, and a 5xx when something is wrong, like a bad config, and it isn’t operating.

This would be very useful for liveness and readiness probes if Home Assistant was run as a container on a container platform such as Kubernetes.

2 Likes

I agree that a health endpoint without authorization would be very useful for monitoring. I just started monitoring HA as well as some other networked appliances with Statping. It a very neat tool that allows you to monitor the uptime.

To accomplish this with the HA-API I had to create an authentication token just for this purpose, which is not ideal, since API tokens are not scoped in Home Assistant. But it’s working very well so far.

I there was a health endpoint, it would also be possible to implement a healthcheck for docker conainers.

I use healthchecks.io in order to check if HA and some other systems are available.

For HTTP monitoring you can use:

http://hass-ip/manifest.json
http://hass-ip/static/icons/favicon.ico
7 Likes

Couldn’t you just make a webhook? HA webhook URLs don’t require authentication. Just make an automation that triggers off a webhook and does nothing. As long as HA is working correctly it will return a 200, if not you’ll get an error.

[EDIT] Ah right, webhooks want POST and respond to GET requests with a 405. Was trying to remember why I wasn’t using one with uptime robot, now I remember. Yea this would be a good enhancement.

A proper and unprotected endpoint would be nice. Just finished configuring uptime kuma, and the /api/ did the trick anyways.

Thank you, this worked for me. I used the /manifest.json endpoint for my liveness, readiness, and startup probes for my Home Assistant instance deployed in k8s.