check process apache with pidfile /usr/local/apache/logs/httpd.pid
start program ="/etc/init.d/httpd start"
stop program ="/etc/init.d/httpd stop"
if cpu > 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 failed host www.tildeslash.com port 80 protocol http
and request "/monit/doc/next.php"
then restart
if failed port 443 type tcpssl protocol http
with timeout 15 seconds
then restart
if 3 restarts within 5 cycles then timeout
depends on apache_bin
group server
:
:
check file apache_bin with path /usr/local/apache/bin/httpd
if failed checksum and
expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
alert security@foo.bar on {
checksum, permission, uid, gid, unmonitor
} with the mail-format { subject: Alarm! }
group server
set alert you@gmail.com with mail-format {
from: my@gmail.com
subject: $SERVICE $EVENT at $DATE
message:
Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
Yours sincerely,
monit
}
set mailserver smtp.gmail.com port 587 username "my@gmail.com" password "mypassword" using tlsv1
check process httpd with pidfile /var/run/httpd.pid
start program ="/etc/init.d/httpd start"
stop program ="/etc/init.d/httpd stop"
if totalcpu > 30% for 3 cycles then alert
if totalcpu > 60% for 1 cycles then alert
if totalcpu > 60% for 5 cycles then restart
if totalmem > 1500.0 MB for 5 cycles then restart
if children > 250 then restart
if failed host www.example.com port 80
protocol HTTP request /alive.html then alert
group httpd
2013年2月4日, 7:10 PM
[…] […]