simple script to monitor and log swarm services' liveness
132
Dockereized simple script to monitor swarm services liveness. Logs are written to the system output and can be transferred to monitoring systems such as ELK/splunk
the log is in json format and contain the following fields:
{"service":"metricbeat","mode":"global","replicas_text":"5/5","running":5,"total":5,"running_pct":1}
{"service":"redis","mode":"replicated","replicas_text":"3/4","running":3,"total":4,"running_pct":0.75}
There are two versios, debian which comes without the docker binaries and must be mounted against docker on the host, and alpine which contains docker binaries inside and needs to mount only the docker sock
alpine version:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock docker-service-logger:alpine-1.0
debian version:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker docker-service-logger:debian-1.0
version: '3.7'
services:
services-logger:
image: 'docker-service-logger:alpine-1.0'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
Content type
Image
Digest
Size
78.8 MB
Last updated
over 7 years ago
docker pull matanper/docker-service-logger:alpine-1.0