# Monitoring the apache2 web services. check process apache2 with pidfile /var/run/apache2.pid start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" if failed host localhost port 80 protocol HTTP request /monit.token then alert if failed host localhost port 80 protocol HTTP request /monit.token for 3 cycles then restart # Admin will notify by mail if below of the condition satisfied. if cpu is greater than 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if totalmem > 200.0 MB for 5 cycles then restart if children > 250 then restart if loadavg(5min) greater than 10 for 8 cycles then stop if 5 restarts within 5 cycles then timeout group www # Monitor cron deamon check process cron with pidfile /var/run/crond.pid group system start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" if 5 restarts within 5 cycles then timeout depends on cron_rc check file cron_rc with path /etc/init.d/cron group system if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor # Monitor ctrlproxy check process ctrlproxy with pidfile /home/matt/.ctrlproxy/pid start program = "/usr/bin/ctrlproxy -D -c /home/matt/.ctrlproxy/" stop program = "/usr/bin/killall ctrlproxy" group irc #Monitoring Mysql Service check process mysql with pidfile /var/run/mysqld/mysqld.pid group database start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout # Monitor Phergie check process phergie with pidfile /home/matt/phergie/phergie.pid start program = "/home/matt/phergie/phergie" stop program = "/home/matt/phergie/phergie stop" if cpu is greater than 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if totalmem > 20.0 MB for 5 cycles then restart if 5 restarts within 5 cycles then timeout group irc #Monitoring ssh Service check process sshd with pidfile /var/run/sshd.pid start program = "/etc/init.d/ssh start" stop program = "/etc/init.d/ssh stop" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout # Monitor syslogd check process syslogd with pidfile /var/run/syslogd.pid start program = "/etc/init.d/sysklogd start" stop program = "/etc/init.d/sysklogd stop" if 5 restarts within 5 cycles then timeout check file syslogd_file with path /var/log/syslog if timestamp > 65 minutes then alert check system nikita.mattread.com if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 85% then alert if cpu usage (user) > 70% then alert if cpu usage (system) > 30% then alert if cpu usage (wait) > 20% then alert check device sda1 with path / if space usage > 80% 5 times within 15 cycles then alert