# this monit config goes in /etc/monit/conf.d check process puma_master with pidfile /data/myapp/current/tmp/puma.pid start program = "/etc/monit/scripts/puma start" stop program = "/etc/monit/scripts/puma stop" group myapp check process puma_worker_0 with pidfile /data/myapp/current/tmp/puma_worker_0.pid if totalmem is greater than 230 MB for 2 cycles then exec "/etc/monit/scripts/puma kill_worker 0" check process puma_worker_1 with pidfile /data/myapp/current/tmp/puma_worker_1.pid if totalmem is greater than 230 MB for 2 cycles then exec "/etc/monit/scripts/puma kill_worker 1" check process puma_worker_2 with pidfile /data/myapp/current/tmp/puma_worker_2.pid if totalmem is greater than 230 MB for 2 cycles then exec "/etc/monit/scripts/puma kill_worker 2" check process puma_worker_3 with pidfile /data/myapp/current/tmp/puma_worker_3.pid if totalmem is greater than 230 MB for 2 cycles then exec "/etc/monit/scripts/puma kill_worker 3"