Service monitoring with Monit ( My Lovely Doggi )
enabling epel repo
# wget http://ftp.riken.jp/Linux/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm ivh epel-release-5-4.noarch.rpm
# yum install monit
config file /etc/monit.conf
verify these lines are uncommented, and you will got many more thing and change the setting as
per as your requirement
# vi /etc/monit.conf
# set daemon mode timeout to 1 minute
set daemon 60
# Include all files from /etc/monit.d/
include /etc/monit.d/*
# cd /etc/monit.d/
# vi apache
check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80 protocol http
and request "/phpinfo.php"
then restart
if 5 restarts within 5 cycles then timeout
# service monit start
# chkconfig --levels 235 monit on
# tailf /var/log/monit
if the apache stop monit will start the service
Comments
Post a Comment