Last active
December 24, 2015 02:19
-
-
Save nessamurmur/6730347 to your computer and use it in GitHub Desktop.
Basic monit example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process unicorn | |
with pidfile /path/to/pid/unicorn.pid | |
start program = "/sbin/service unicorn start" with timeout 120 seconds | |
stop program = "/sbin/service unicorn stop" | |
if totalmem is greater than 500 MB for 2 cycles then restart |
Author
nessamurmur
commented
Sep 27, 2013
- Define the process you want monit to monitor, in this case we'll call the process unicorn. This will let you run:
- Next tell monit where to find the process id to know a process is running.
- Next, feed unicorn the command to run to start the service. You can add options like "with timeout 120 seconds" or "as uid unprivileged_user"
- Tell monit how to stop the program.
- You can add other conditionals like this one to restart the process if it starts eating too much memory.
This file lives in /etc/monit.d/ by default.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment