set mailserver cpt0.carpooltool.com set daemon 120 # Poll at 2-minute intervals set logfile /var/log/monit.log set alert address@hidden mail-format { from: address@hidden } set httpd port 2812 ssl enable pemfile /usr/local/share/ssl/monit.pem clientpemfile /usr/local/share/ssl/monit_client.pem allowselfcertification allow monit:k33p1tup check system cpt0.carpooltool.com if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 75% then alert if cpu usage (user) > 75% then alert if cpu usage (system) > 40% then alert if cpu usage (wait) > 40% then alert check process apache with pidfile "/home/cpt/fgs/www/logs/httpd.pid" start program = "/home/cpt/fgs/www/bin/apachectl start" stop program = "/home/cpt/fgs/www/bin/apachectl stop" #if 2 restarts within 3 cycles then timeout if totalmem > 225 Mb for 5 cycles then alert if children > 255 for 5 cycles then alert if cpu usage > 95% for 3 cycles then alert #if failed port 443 type tcpssl protocol http then alert #if failed port 80 protocol http then alert if failed url http://cpt0.carpooltool.com:80/monit.txt then alert if failed host cpt0.carpooltool.com port 80 protocol apache-status dnslimit > 25% or loglimit > 80% or waitlimit < 20% then alert group server depends on httpd.conf, httpd.bin check file httpd.conf with path /home/cpt/fgs/www/conf/live.httpd.conf # Reload apache if the httpd.conf file was changed if changed checksum then alert #then exec "/home/cpt/fgs/www/bin/apachectl graceful" check file httpd.bin with path /home/cpt/fgs/www/bin/httpd # Alert in the case that the binary was changed and alert in the case that # the checksum value recovered later if failed checksum then alert else if recovered then alert check process sshd with pidfile /var/run/sshd.pid if failed port 22 protocol ssh then alert start program = "/etc/init.d/sshd start" start program = "/etc/init.d/sshd stop" group server 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 then alert group server check process postgres with pidfile /var/lib/postgresql/data/postmaster.pid if failed port 5432 protocol pgsql then alert group server check process fcron with pidfile /var/run/fcron.pid group server check process pathserv_l0 with pidfile /home/cpt/DEV/source/et/util/route/astar/remoting/dev5/L0/BINDER_PID group server check process pathserv_l1 with pidfile /home/cpt/DEV/source/et/util/route/astar/remoting/dev5/L1/BINDER_PID group server check host cpt1 with address cpt1.carpooltool.com if failed icmp type echo count 5 with timeout 15 seconds then alert if failed url https://monit:address@hidden:443/monit.txt then alert if failed port 22 protocol ssh with timeout 15 seconds then alert if failed port 5432 protocol pgsql with timeout 15 seconds then alert check host cpt2 with address cpt2.carpooltool.com if failed icmp type echo count 5 with timeout 15 seconds then alert if failed url https://monit:address@hidden:443/monit.txt then alert if failed port 22 protocol ssh with timeout 15 seconds then alert