My first thought would be Monit, which I use to monitor other processes.
Is there a different way of doing this in the Docker universe?
I wish to monitor both the Docker daemon and specific containers.
Specific to containers there is the --restart
flag for the run
command: https://docs.docker.com/engine/reference/commandline/run/#restart-policies-restart.
On more modern Linux distributions (such as CoreOS and Ubuntu) you get systemd and Upstart managing the daemons.
For example, on Ubuntu, the default Upstart configuration for Docker has the respawn
stanza (http://upstart.ubuntu.com/cookbook/#respawn) enabled by default.
In systemd land, CoreOS has something like this to launch the Docker daemon: https://github.com/coreos/coreos-overlay/blob/bed6ea27913a1d9595b62e05174ac4a841c7fabb/app-emulation/docker/files/docker.service. You can customize (https://coreos.com/os/docs/latest/customizing-docker.html) the systemd units that get used and use the Restart=
option (http://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=) to achieve similar functionality.
However, both of these options don't do any native alerting or messaging. Though, you could probably configure some sort of "mailer" unit that runs OnFailure=
of the Docker systemd unit. But I'd call this out of scope for Docker and the init systems.