Skip to content

Instantly share code, notes, and snippets.

@ns408
Forked from joeyimbasciano/monit.myapp.conf
Created February 24, 2018 00:45
Show Gist options
  • Save ns408/68138677f24ebe21acbafcbd656c1caf to your computer and use it in GitHub Desktop.
Save ns408/68138677f24ebe21acbafcbd656c1caf to your computer and use it in GitHub Desktop.
Monit configuration file to check HTTP service listening on port 9009 and recovery from DNS failures
check host appsrv1 with address 127.0.0.1
start program = "/sbin/start myapp"
stop program = "/sbin/stop myapp"
alert alerts@example.com on {timeout,connection}
if failed port 9009 protocol HTTP
request /
with timeout 3 seconds
then restart
if 10 restarts within 10 cycles then timeout
if 10 restarts within 10 cycles then exec "/usr/bin/monit start aws-dns-healthcheck"
check host aws-dns-healthcheck with address 172.16.0.23
if failed port 53 type udp protocol dns within 3 cycles
then alert else if succeeded for 3 cycles then exec "/usr/local/sbin/kick-myapp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment