Accessing Python from the base OS

Hi all,
I’m trying to run a Python script from the base OS to monitor HomeAssistant with my monitoring software. It needs to be run from the host since the dockers themselves are monitored with commands such as docker ps.
I’m able to run Python from the homeassistant or the hassio_supervisor containers. However, copying my script in there doesn’t help since the script running within the container doesn’t have access to the host machine.

# docker exec -it homeassistant python /tmp/mk_docker.py
mk_docker.py: Does not seem to be a docker host. Terminating.

I’m not an expert on the matter but I’m starting to think that what I’m trying to do is impossible. I’d need to rewrite the Python script into a bash script to be able to run it from the host. Unless I’m missing something obvious here (hence my question).

Indeed. You’re not supposed to install / do anything on HAOS itself.

Whichever that is, HA can expose a Prometheus endpoint, which is largely supported by monitoring software.

Thank you, I just looked into the Prometheus endpoint. It’s not exactly what I was looking for but it’s still definitely relevant and compatible with most modern monitoring solutions. I was really hoping to be able to run Python from the base OS but I now understand it’s preferable not to.