Created
April 6, 2011 14:21
-
-
Save codypo/905730 to your computer and use it in GitHub Desktop.
Monit example for restarting a service on excessive memory consumption
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
# Relevant example from our monitrc file. | |
check process couchdb with pidfile /usr/local/var/run/couchdb/couchdb.pid | |
start program = "/etc/init.d/couchdb start" | |
stop program = "/etc/init.d/couchdb stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 70% MB for 5 cycles then restart |
In the original example, if memory usage > 70% MB for 5 cycles then restart
seems ambiguous. It looks like it should either be %
or MB
in the documentation, not both. I would guess that in this case monit would use the % and ignore the MB (or maybe throw an error?) but I'm not sure and it doesn't seem like a good idea to have the ambiguity!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try
totalmem
. Example httpd rule (Amazon Linux/CentOS/RHEL):