Skip to content

Commit

Permalink
Merge branch 'fix/autoheal' into 'master'
Browse files Browse the repository at this point in the history
Make sure the health check only fails once (/tmp/ dir is not cleaned up on restart)

See merge request grafolean/grafolean-collector-snmp!12
  • Loading branch information
grafolean committed Nov 3, 2019
2 parents 87118ef + 3f94442 commit 85aacd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ RUN \
echo "alias l='ls -altr'" >> /root/.bashrc
COPY --from=build-backend /snmpcollector/ /snmpcollector/
WORKDIR /snmpcollector
HEALTHCHECK --interval=10s --retries=1 CMD /bin/bash -c "[ ! -f /tmp/fail_health_check ]"
# check for "fail" file and if it exists, remove it and fail the check:
HEALTHCHECK --interval=10s --retries=1 CMD /bin/bash -c "[ ! -f /tmp/fail_health_check ] || ( rm /tmp/fail_health_check && exit 1 )"
CMD ["python", "-m", "snmpcollector"]
1 change: 1 addition & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ services:
container_name: autoheal-snmp
environment:
- AUTOHEAL_CONTAINER_LABEL=all
- AUTOHEAL_INTERVAL=5 # check every 5 seconds - this must be lower than the period of Docker container HEALTHCHECK we are monitoring
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always

0 comments on commit 85aacd3

Please sign in to comment.