Monit是一款功能非常丰富的进程、文件、目录和设备的监测软件,用于Unix平台。 它可以自动修复那些已经停止运作的程序,monit运行于应用层。
原文:Monitor daemon processes, files, devices and remote systems
软件名: monit
主页:
软件官方下载:
当前版本: monit-5.1.1 (23 February 2010)
安装:
#./configure --prefix=/usr/local/monit
#make
#make install
|
原始模板配置文件:
运行环境说明:
本机IP:192.168.11.12 monit通过mail.com服务器通过smtp方式发送邮件到diocorns@mail.com邮箱 只允许192.168.77.49访问monit web service monit web service监听port 2812 监控http服务 |
配置文件:
/etc/monitrc
set daemon 120 # check services at 2-minute intervals
with start delay 240
set logfile /var/log/monitor.log
set idfile /var/run/.monit.id
set statefile /var/run/.monit.state
set mailserver mail.com, # primary mailserver
set eventqueue
basedir /var/monit # set the base directory where events will be stored
slots 100 # optionally limit the queue size
set mail-format { from: diocorns@mail.com }
set alert diocorns@mail.com # receive all alerts
set httpd port 2812 and
use address 192.168.11.120 # only accept connection from localhost
allow 192.168.77.49 # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
check process apache with pidfile /etc/httpd/run/httpd.pid
start program = "/etc/init.d/httpd start" with timeout 10 seconds
stop program = "/etc/init.d/httpd stop"
if cpu > 80% for 5 cycles then restart
if failed host 192.168.11.120 port 80 protocol http
and request "/index.php"
then restart
group server
|
启动服务:
#/usr/local/monit/bin/monit -Ic /etc/monitrc
|
阅读(782) | 评论(0) | 转发(0) |