Skip to content

Instantly share code, notes, and snippets.

@hozumi
Last active December 15, 2015 06:48
Show Gist options
  • Save hozumi/5218502 to your computer and use it in GitHub Desktop.
Save hozumi/5218502 to your computer and use it in GitHub Desktop.
monit setting
set daemon 60
set logfile syslog facility log_daemon
set idfile /var/.monit.id
set statefile /var/.monit.state
set mailserver smtp.gmail.com port 587
username "[email protected]" password "mypassword"
using tlsv1
with timeout 30 seconds
set alert [email protected]
set httpd port 2813 address localhost
allow localhost
allow admin:mypassword
check process datomic with pidfile "/home/myuser/.datomic-free/datomic.pid"
start program = "/bin/su - myuser -c '/home/myuser/.datomic-free/bin/datomic-free start /home/myuser/.datomic-free/transactor.properties'"
stop program = "/bin/kill `cat /home/myuser/.datomic-free/datomic.pid`"
if cpu > 60% for 3 cycles then alert
if cpu > 90% for 5 cycles then restart
if totalmem > 500.0 MB for 5 cycles then restart
if 3 restarts within 4 cycles then alert
check process myapp with pidfile "/home/myuser/myapp/daemon.pid"
start program = "/bin/su - myuser -c '/home/myuser/myapp/bin/daemon.sh start'"
stop program = "/bin/kill `cat /home/myuser/myapp/daemon.pid`"
if failed port 8080 and protocol http
and request "/" then restart
if cpu > 60% for 3 cycles then alert
if cpu > 90% for 5 cycles then restart
if totalmem > 800.0 MB for 5 cycles then restart
if 3 restarts within 4 cycles then alert
depends on datomic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment