Monitoring Homeassistant

How can I, after installing Homeassistant, verify it is running well?
I’d like to have some automated check so

  • my Ansible script can verify it ran successfully
  • my monitoring system can alarm as soon as Homeassistant does not run.

I assume there would be some URL endpoint and maybe a verification of the returned content. But what is it exactly?

curl --connect-timeout 10 --silent -f http://127.0.0.1:8123/ || exit 1 

Above is my line used as Docker container health check. Replace 127…1 with the IP/hostname of your HA installation.

And HA supports exposing metrics for Prometheus.

That test will at most check if the port is open. It does not even check for the login screen.
So far I was doing the very same but actually I am hoping for something smarter.

Maybe I should check what can be exposed for Prometheus.

You could look at the code for the Website Checker component to see if you can recycle some of the Python code for your own use. I use this to check on various websites I manage and it actually checks for Code 200/400/etc to know if the site is operating properly or not.

A website is considered OK when an HTTP request returned with a response code < 500. Or the other way around it is considered a problem if the HTTP request failed or returned a response code >= 500.

That‘s how the Docker health check works…