Sign inSign up

stvfccn/http-docker-servicemon

By stvfccn

•Updated over 7 years ago

Image
0

218

stvfccn/http-docker-servicemon repository overview

⁠Docker service monitor

Simple HTTP server written in python that monitors the deployment of multiple instances of a service in a swarm. It checks if all instances of the service are properly running.

It uses the docker SDK for python⁠ to list the service tasks and check their state. The results are presented in a web page and are refreshed on a given timer.

There are three possible outcomes for the monitoring:

  • When the all instances of the service are running
OK:
- my_service[running] - started
- my_service[running] - started

  • When not all instances of the service are running
FAIL: not all services are started [1/2]:
- my_service[running] - started
- my_service[starting] - starting

  • When the service is not running
ERROR: service is stopped

⁠Installing and running

You can get the latest version of this server from Docker Hub⁠ by running docker pull stvfccn/http-docker-servicemon.

Use the following sample configuration to deploy this monitor as a service in your swarm:

version: '3.4'
services:
  monitor:
    image: stvfccn/http-docker-servicemon
    environment:
      PORT: 8000
      SERVICE_NAME: portainer
    ports:
      - target: 8000
        published: 8000
        protocol: tcp
        mode: host
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

This configuration would be monitoring my-service and presenting the monitorization results on http://localhost:8000⁠. Make sure to define the environment vars PORT and SERVICE_NAME to your designated port and service.

⁠Author

Paulo Costa

Tag summary

Content type

Image

Digest

Size

35 MB

Last updated

over 7 years ago

docker pull stvfccn/http-docker-servicemon