or
How to make sure that apache are running? and If server load go too high please restart it for me.
Monit can help you monitoring common for system admin.
It can monitoring server process, file size, memory server load. And, you can set the appropriate action to those events: sending email, restart process etc.
To install monit
for gentoo :
#emerge -av monit
for debian:
#apt-get install monit
Configuring monit
Locate configuration file : /etc/monitrc or /etc/monit/monitrc
Here is the example configuration for apache with these condition
1) check whether apache is running : if not restart
2) check http:80 is working : if not restart
3) if server go to high : restart apache process
set daemon 120
set mailserver smtp.localhost
set mail-format { from: admin@localhost.com }
set alert systemadmin@localhost.com
check process apache with pidfile /var/run/apache2.pid
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if failed port 80 protocol http then restart
if loadavg(5min) greater than 100 for 2 cycles then restart
alert extrapeople@localhost.com
If you are interested in monit for advance feature please visit monit official site.
check out monit document
ไม่มีความคิดเห็น:
แสดงความคิดเห็น