Tim Igoe's Web Design, Development and Hosting Blog

Monit Rules

Posted on by Tim Igoe

As a follow on from my post on Monit, I have compiled a selection of rules that can be used to monitor various services on your server.


check process sshd with pidfile /var/run/sshd.pid
start program  "/etc/init.d/sshd start"
stop program  "/etc/init.d/sshd stop"
if failed port 22 protocol ssh for 3 cycles then restart
if 5 restarts within 5 cycles then timeout


check process postfix with pidfile /var/spool/postfix/pid/master.pid
start program = "/etc/init.d/postfix start"
stop  program = "/etc/init.d/postfix stop"
if failed port 25 protocol smtp for 3 cycles then restart
if 5 restarts within 5 cycles then timeout


check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed unixsocket /var/lib/mysql/mysql.sock protocol mysql for 3 cycles then restart
if 5 restarts within 5 cycles then timeout


check filesystem rootfs with path /
if space usage > 90% 5 times within 15 cycles
then alert


check system localhost
if loadavg (1min) > 10 then alert
if loadavg (5min) > 7 then alert
if memory usage > 95% then alert
if cpu usage (user) > 95% then alert
if cpu usage (system) > 70% then alert
if cpu usage (wait) > 80% then alert

This entry was posted in Linux, Servers and tagged , , , , . Bookmark the permalink.

Leave a Reply