{"id":13548571,"url":"https://github.com/RafhaanShah/Container-Mon","last_synced_at":"2025-04-02T21:31:47.220Z","repository":{"id":65195046,"uuid":"316780716","full_name":"RafhaanShah/Container-Mon","owner":"RafhaanShah","description":"Get notified when your Docker containers are unhealthy","archived":false,"fork":false,"pushed_at":"2025-03-13T01:44:48.000Z","size":169,"stargazers_count":63,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-13T02:33:11.294Z","etag":null,"topics":["docker","go","notifications"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RafhaanShah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-28T16:58:39.000Z","updated_at":"2025-03-13T01:44:45.000Z","dependencies_parsed_at":"2023-02-17T00:10:25.019Z","dependency_job_id":"9d754a87-c16f-4ead-a43a-ab8d1e49d761","html_url":"https://github.com/RafhaanShah/Container-Mon","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RafhaanShah%2FContainer-Mon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RafhaanShah%2FContainer-Mon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RafhaanShah%2FContainer-Mon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RafhaanShah%2FContainer-Mon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RafhaanShah","download_url":"https://codeload.github.com/RafhaanShah/Container-Mon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895813,"owners_count":20851332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","go","notifications"],"created_at":"2024-08-01T12:01:11.951Z","updated_at":"2025-04-02T21:31:46.950Z","avatar_url":"https://github.com/RafhaanShah.png","language":"Go","funding_links":[],"categories":["Go","go"],"sub_categories":[],"readme":"\n# Container-Mon\n\nGet notified when your [Docker](https://www.docker.com/) containers are unhealthy.\n\n![](/assets/screenshot.jpg)\n\n## Prerequisites\n- Have [Go](https://golang.org/) 1.18+ or [Docker](https://www.docker.com/) installed\n- A notification service supported by [Shoutrrr](https://containrrr.dev/shoutrrr/services/overview/) and the required API keys or other configuration for your chosen service (e.g: Telegram, Discord, Slack, Teams etc)\n\n## Configuration\nAll configuration is done via environment variables, see the table below for all options and default values. Only `CONTAINERMON_NOTIFICATION_URL` is mandatory, all other fields are optional.\n| Name                            | Type   | Default Value         | Description                                                                                                                                                                  |\n|---------------------------------|--------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CONTAINERMON\\_FAIL\\_LIMIT       | Int    | 1                     | Number of consecutive 'unhealthy' checks to reach before sending a notification                                                                                              |\n| CONTAINERMON\\_CRON              | String | */5 * * * *           | Standard [Cron](https://crontab.guru/#*/5_*_*_*_*) schedule of when to run healthchecks                                                                                      |\n| CONTAINERMON\\_NOTIFICATION\\_URL | String | N/A                   | Notification URL for [Shoutrrr](https://containrrr\\.dev/shoutrrr/services/overview/). Multiple services can be used with the `\\|` (pipe) character as a separator. |\n| CONTAINERMON\\_USE\\_LABELS       | Bool   | false                 | If `true` will only monitor containers with the label `containermon.enable=true` set                                                                                         |\n| CONTAINERMON\\_NOTIFY\\_HEALTHY   | Bool   | true                  | If `true` will send a notification when an 'unhealthy' container returns to being 'healthy'                                                                                  |\n| CONTAINERMON\\_CHECK\\_STOPPED    | Bool   | true                  | If `true` will consider `stopped` containers as 'unhealthy'\\. If `false`, you will only be notified for containers that have a `healthcheck` set                             |\n| CONTAINERMON\\_MESSAGE\\_PREFIX   | String | N/A                   | Custom text to be prefixed to all notification messages.                                                                                                                     |\n| DOCKER\\_HOST                    | String | /var/run/docker\\.sock | Path for the Docker API socket                                                                                                                                               |\n| DOCKER\\_API\\_VERSION            | String | docker default        | Docker API version to use                                                                                                                                                    |\n| DOCKER\\_CERT\\_PATH              | String | docker default        | Path to load the TLS certificates from                                                                                                                                       |\n| DOCKER\\_TLS\\_VERIFY             | Bool   | false                 | Enable or disable TLS verification                                                                                                                                           |                                                |                                                                  |\n\n## Usage\n- Stand-alone:\n\t`go run app.go`\n- Docker:\n  ```\n\tdocker run \\\n\t-v /var/run/docker.sock:/var/run/docker.sock \\\n\t-e CONTAINERMON_NOTIFICATION_URL=telegram://token@telegram?channels=channel-1 \\\n\tghcr.io/rafhaanshah/container-mon:latest\n  ```\n- Docker-Compose:\n  ```\n  version: \"3.8\"\n    services:\n      container-mon:\n        container_name: container-mon\n        image: ghcr.io/rafhaanshah/container-mon:latest\n        restart: unless-stopped\n        volumes:\n          - /var/run/docker.sock:/var/run/docker.sock\n        environment:\n          - CONTAINERMON_NOTIFICATION_URL=telegram://token@telegram?channels=channel-1\n  ```\n\n## Troubleshooting\n- Docker API version issues: if you get error messages like `client version 1.43 is too new. Maximum supported API version is 1.42` then please set the `DOCKER_API_VERSION` environment variable to the latest version supported by your Docker engine (e.g. `DOCKER_API_VERSION=1.42`, which you can check by running `docker version`.\n- Notifier issues: please check if your URL works with the Shoutrrr CLI from [here](https://containrrr.dev/shoutrrr/0.7/getting-started/#through_the_cli).\n\n## Security Considerations\n- It can be considered a security risk to directly map your Docket socket inside a container. A proxy such as [Socket-Proxy](https://github.com/Tecnativa/docker-socket-proxy) can be used to give fine-grained access to parts of the Docker API, this application only needs to be able to read a list of running containers -\u003e\n  ```\n\tdocker run \\\n\t-e DOCKER_HOST=tcp://socket-proxy:2375\n\t...\n   ```\n- This container runs as `root` by default to access the Docker socket. You may run it as another user that has access to the socket as described here: [Running a Docker container as a non-root user](https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15) -\u003e\n  ```\n\tdocker run \\\n\t-u $(id -u):$(stat -c '%g' \"/var/run/docker.sock\") \\\n\t...\n   ```\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRafhaanShah%2FContainer-Mon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRafhaanShah%2FContainer-Mon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRafhaanShah%2FContainer-Mon/lists"}