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:
OK:
- my_service[running] - started
- my_service[running] - started
FAIL: not all services are started [1/2]:
- my_service[running] - started
- my_service[starting] - starting
ERROR: service is stopped
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.
Paulo Costa
Content type
Image
Digest
Size
35 MB
Last updated
over 7 years ago
docker pull stvfccn/http-docker-servicemon