willfarrell / docker-autoheal

Monitor and restart unhealthy docker containers.
MIT License
1.31k stars 225 forks source link

Restart count? #104

Open hgezim opened 1 year ago

hgezim commented 1 year ago

Is there a way I can see the number of restarts that have happened?

hasnat commented 1 year ago

Think it's time to think about metrics of health check events. Possibly something like a Prometheus endpoint?

hasnat commented 1 year ago

Is there a way I can see the number of restarts that have happened?

Healthchecks itself, no. Basis possibly was Health check was lean enough to do only instructed restarts and no more.

One can track events themselves by 3rd party.

RXWatcher commented 1 year ago

I used the PR to run a script to track and take action.

I have a script that is triggered by a container restart that logs the date, time, container name of each container restarted. If X restarts happen within Y minutes then the script calls another script to resolve the issue vs manually getting involved to resolve the issue.

On Thu, Apr 27, 2023, 21:37 Hasnat @.***> wrote:

Is there a way I can see the number of restarts that have happened?

Healthchecks itself, no. Basis possibly was Health check was lean enough to do only instructed restarts and no more.

One can track events themselves by 3rd party.

— Reply to this email directly, view it on GitHub https://github.com/willfarrell/docker-autoheal/issues/104#issuecomment-1526266079, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLOXCMMWXG4ALDVKEJ67EDXDLDHDANCNFSM6AAAAAAXODPDSI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

hgezim commented 1 year ago

I used the PR to run a script to track and take action.

What do you mean by PR?

hgezim commented 1 year ago

It's kind of silly but I didn't realize there's two kinds of restarts: one managed by docker and handled by restart policy and one handled by autoheal and health check. Ideally, I'd like to keep track of both kinds.

RXWatcher commented 1 year ago

PR is a Pull Request. It's someone who has made a modification to the original software and is asking for it to be merged into the original code. I take it you aren't a developer. It's fine but it's common lingo in the open source community.

https://github.com/willfarrell/docker-autoheal/pull/101

I have a docker image out there with this and other PRs merged in with some of my own customizations. I havent properly documented it as its really for personal use but its on dockerhub.

On Thu, Apr 27, 2023 at 10:56 PM Gezim Hoxha @.***> wrote:

I used the PR to run a script to track and take action.

What do you mean by PR?

— Reply to this email directly, view it on GitHub https://github.com/willfarrell/docker-autoheal/issues/104#issuecomment-1526444782, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLOXCPSHMT7JKWGUIGVGITXDLMPTANCNFSM6AAAAAAXODPDSI . You are receiving this because you commented.Message ID: @.***>

hasnat commented 1 year ago

It's kind of silly but I didn't realize there's two kinds of restarts: one managed by docker and handled by restart policy and one handled by autoheal and health check. Ideally, I'd like to keep track of both kinds.

likely you'd be interested in more events too like stop/destroy/create. You can somewhat manage then externally e.g. https://github.com/hasnat/docker-events-notifier

You main questions stays valid if autoheal should report/track its own actions?

tiomny commented 1 year ago

102