Giter VIP home page Giter VIP logo

docker-event-monitor's People

Contributors

dependabot[bot] avatar dl6er avatar yubiuser avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

dl6er

docker-event-monitor's Issues

Be better at reporting container death

One of my containers kept restarting because of a typo in its docker-compose.yml file. docker-event-monitor was very useful in figuring this out because my inbox kept filling:

Screenshot from 2023-09-23 12-37-31

The first one was

Object 'Container' with ID 88085b96 from image containrrr/watchtower reported: stop

All following are:

Object 'Container' with ID 2de67b6b from image containrrr/watchtower reported: start

docker events told me container die which was more helpful at pointing me into the right direction. Maybe docker-event-monitor can be improved in this way.

Add server-subtag

As mentioned in #22 (comment), watchtower has a setting called WATCHTOWER_NOTIFICATION_EMAIL_SUBJECTTAG that injects a server name into the subject, like:

From: ...
Subject: [server.dl6er.de] Container gitea-db-1 restarted
Content: ...

Having such an option would allow me to use docker-event-monitor better as I would be using it on three machines running in three different locations/networks.

Improve docker-compose support

What is the problem?

I heavily use docker compose to provide individual services on my servers. When docker-event-monitor sends me a message like

Object 'Container' with ID 2a51bd18 from image postgres:14 reported: stop

it is difficult to know which container was actually affected because years after I have set up my gitea, I might simply have forgotten that postgres is used here. Another possibility would be that it could be used more than once, e.g., when using several provided docker-compose.yml files from various resources on the web.

Background

The structure of my services (all managed using docker compose) is pretty common, like

/home/<user>/docker
/home/<user>/docker/gittea
/home/<user>/docker/gittea/docker-compose.yml
/home/<user>/docker/proxy
/home/<user>/docker/proxy/docker-compose.yml
/home/<user>/docker/bbb
/home/<user>/docker/bbb/docker-compose.yml
/home/<user>/docker/mailserver
/home/<user>/docker/mailserver/docker-compose.yml
/home/<user>/docker/watchtower
/home/<user>/docker/watchtower/docker-compose.yml
... (several more)

(yes, they are intentionally not running as root)

My suggestion

Include details about the docker compose context if applicable. The information should be available through the docker events, e.g.:

2023-09-23T10:29:15.081683269+02:00 container restart 2a51bd189e885381c80d63c8f6d7906a5f220f93412beb9b6eb96e9dfdd2efc4 (com.docker.compose.config-hash=20d8294d54fe37f3c8f4395ba8db4770df004b762180be24af6dcad170c4396c, com.docker.compose.container-number=1, com.docker.compose.depends_on=, com.docker.compose.image=sha256:4d8f13d97fae84ee0f5e9231b89a7957839a8de3ff49b7faab1feac5cab01b6c, com.docker.compose.oneoff=False, com.docker.compose.project=gitea, com.docker.compose.project.config_files=/home/<user>/docker/gitea/docker-compose.yml, com.docker.compose.project.working_dir=/home/<user>/docker/gitea, com.docker.compose.replace=7166e98e5db5339990b54505dd3a62e9b179b53cf0b0a16b0771639aef2ce247, com.docker.compose.service=db, com.docker.compose.version=2.20.2, image=postgres:14, name=gitea-db-1)

Specifically:

  • name=gitea-db-1
  • com.docker.compose.project=gitea
  • com.docker.compose.service=db
  • com.docker.compose.project.working_dir=/home/<user>/docker/gitea

To a human consuming the messages generated by docker-event-monitor, name may also be a more obvious choice than the currently printed container ID.

Example message

With docker compose context:

From: ...
Subject: gitea-db-1 container restart
Content: Container gitea-db-1 (gitea:db defined in /home/<user>/docker/gitea) was restarted

Without docker compose:

From: ...
Subject: nginx container restart
Content: Container nginx was restarted

Improve message title/content

These are the messages I'm referring to in the remainder of this issue ticket:
Screenshot from 2023-09-23 10-16-33

The first message I ever received contained a timestamp string, nothing else. The title was helpful:

Screenshot from 2023-09-23 10-16-44

The following messages did not contain a useful title, but what happened was now in the content of the mail:

Screenshot from 2023-09-23 10-16-50
Screenshot from 2023-09-23 10-16-54

My suggestions at this point would be to

  1. Improve the status message to something like
    Docker event monitor was started at XX-XX-2023 XX:YY:ZZ
    
    (or similar)
  2. Change the header from the generic New Docker Event to something dynamic like Container postgres:14: stop. For brevity, you could even skip the leading "Container" and use the title/subject postgres:14: stop and, subsequently, postgres:14: start

I am aware that my suggestion is based on the e-mail reporting where a sender will always be visible allowing to identify the origin immediately. I am not using any of the other notification method your monitor offers, so I cannot speak for them if the same change would be useful over there as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.