tomaae / homeassistant-portainer

Portainer integration for Home Assistant
Apache License 2.0
93 stars 7 forks source link

[Feature] Implement health-checks as status #24

Open luc-ass opened 11 months ago

luc-ass commented 11 months ago

Is your feature request related to a problem? Please describe.

I have implemented health-checks for most of my containers, which is really helpful when trying to solve problems before they affect production. This feature is not available via the integration, thus making it impossible to reflect the actual status in home assistant (running ≠ healthy).

Describe the solution you'd like

Implement (if possible) health status, so that the dashboard for example could show all containers that are unhealthy.

Describe alternatives you've considered

Additional context

luc-ass commented 11 months ago

As portioner seems to act like a reverse-proxy against the docker, this could also work:

From what I was able to find in the documentation for /containers/json this does not actually include the health status:

"State": "Exited",
"Status": "Exit 0",

Digging deeper, the documentation for containers/{id}/json does actually contain information about container health:

"State": {
    "Error": "",
    "ExitCode": 9,
    "FinishedAt": "2015-01-06T15:47:32.080254511Z",
    "Health": {
        "Status": "healthy",
        "FailingStreak": 0,
        "Log": []
    },

So this would be a possible solution... alternatively /events seems to contain this kind of information... but I don't know how practical this kind of stream would be.

webysther commented 9 months ago

This will be great, to become build block for a future switch support, because running works, but with healthy status when supported will be really nice.