yum  -y  install  epel-release
yum  -y  install  monitset daemon  30
set log syslog
set httpd port 2812 and
use address 172.20.10.11
allow 172.20.10.2
allow admin:monit
#with ssl {            # enable SSL/TLS and set path to server certificate
#    pemfile: /etc/ssl/certs/monit.pem
#}
include /etc/monit.d/*check  process  apache  with  pidfile  /etc/httpd/logs/httpd.pid
start  program  =  "/usr/bin/systemctl  start  httpd"
stop  program    =  "/usr/bin/systemctl  stop  httpd"b. 监控mysql:
vim  /etc/monit.d/mysql
check  process  mysql  with  pidfile  /usr/local/mysql/data/lee.pid
start  program  =  "/usr/bin/systemctl  start  mysqld"
stop  program    =  "/usr/bin/systemctl  stop  mysqld"c. 监控ssh:
vim  /etc/monit.d/ssh
check  process  ssh  with  pidfile  /run/sshd.pid
start  program  =  "/usr/bin/systemctl  start  sshd"
stop  program    =  "/usr/bin/systemctl  stop  sshd"monit  -t
b. 启动服务:
systemctl  start  monitc. 停止服务:
systemctl  stop  monitd. 重启服务:
systemctl  restart  monite. 查看服务运行状态:
systemctl  status  monit  -lf. 查看错误日志:
tail  /var/log/monit.log

原文:http://blog.51cto.com/12173069/2307649