| |
a) Run it as daemon and check the services (such as web, mysql, sshd) at 2-minute
intervals.
set daemon 120
b) Set syslog logging with the ‘daemon’ facility:
set logfile syslog facility log_daemon
c) Set mail server name to send email alert
set mailserver mail.cyberciti.biz
Set email format such as from email
set mail-format { from: alert@nixcraft.in
subject: $SERVICE $EVENT at $DATE
message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
}
d) Now most important part, restart lighttpd or apache web server if failed or killed by Linux kernel due to any causes:
check process lighttpd with pidfile /var/run/lighttpd.pid
group lighttpd
start program = "/etc/init.d/lighttpd start"
stop program = "/etc/init.d/lighttpd stop"
if failed host 75.126.43.232 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout
Where,
check process lighttpd with pidfile /var/run/lighttpd.pid : You are specifying lighttpd pid file and daemon name
group lighttpd : Specify group name, which is allowed or used to start/restart lighttpd
start program = “/etc/init.d/lighttpd start” : Command to start lighttpd server
stop program = “/etc/init.d/lighttpd stop” |
|