Home

Awesome

Docker 996.icu License LICENSE

Introduction

The SwarmAlert app monitors the availability of services running in a Docker Swarm environment.

It offers an optional WHITELIST of services to monitor. If a WHITELIST is not defined, ALL services in the Swarm are monitored by default.

An optional BLACKLIST is also configurable, and takes precedence over the whitelist and defaults. This is to allow you to use the BLACKLIST to avoid receiving alerts while doing planned maintenance. The app checks every CHECK_INTERVAL seconds. Upon checking, if a specified service has no running task, the app generates a Notification that is send to the services configured on the config.yml file. More information about the config.yml format is available on the apprise repository: apprise config yaml file reference

The Msg_Prefix is used to customize the message send to the notification providers.

Note: This project is based on monitor-docker-slack

General Idea

  1. Run one or more services in Docker Swarm mode.
  2. Start this service to monitor the availability of other services.
  3. Monitor services each CHECK_INTERVAL seconds for services with no running containers.
  4. Send a pushover notifications containing the unavailable services.

Usage: Docker-compose

version: '3'
services:
  swarm-alert:
    image: gpulidodt/swarm-alert:latest
    volumes:
     - /var/run/docker.sock:/var/run/docker.sock
     - /path_to_config/config.yml:/src/config.yml
    environment:
     - PUSHOVER_USER_KEY: user_key_from_pushover
     - PUSHOVER_API_TOKEN: your_app_token_from_pushover
     - MSG_PREFIX: '$MSG_PREFIX'
     - WHITE_LIST: ''traefik_traefik','plex_plex','test_service''
     - BLACK_LIST: ''test_service''
     - LOGGING_LEVEL: INFO | DEBUG

Further customization

 - MSG_PREFIX="Swarm services"
 - WHITE_LIST="nodeexporter,ngin.*"
 - BLACK_LIST="nodeexporter,ngin.*"

Code is licensed under MIT license