Skip to content

Instantly share code, notes, and snippets.

@the-frey
Last active May 8, 2021 17:01
Show Gist options
  • Save the-frey/466a53a6d1fc926dbd4f to your computer and use it in GitHub Desktop.
Save the-frey/466a53a6d1fc926dbd4f to your computer and use it in GitHub Desktop.
Monit Service Monitor Block for Docker Container
# Inside main monitrc
# Check that services are running and also define start and stop commands for them.
# You will need one of these for each container
# as well as working out a restarting and/or red
eploying workflow.
check process <container-name> with pidfile /var/run/monit/<container-name>.pid
start = "/path/to/pid/script start <container-name> '<docker-arguments>'"
stop = "/path/to/pid/script stop <container-name>"
if does not exist then alert
if cpu equal 0%
and memory equal 0kB
for 5 cycles then alert
@beechnut
Copy link

beechnut commented Dec 1, 2014

To clarify, the /path/to/pid/script should refer to the PID Wrapper for Docker and Monit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment