1、安装

1
yum install -y monit;
1
monit --version
1
2
3
This is Monit version 5.25.1
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2017 Tildeslash Ltd. All Rights Reserved.
1
2
# 默认配置文件
cat /etc/monitrc

2、systemd

1
systemctl enable monit

3、监控nginx

1
vi /etc/monit.d/nginx
1
2
3
check process nginx with pidfile /data/nginx/logs/nginx.pid
start program = "/data/nginx/sbin/nginx"
stop program  = "/data/nginx/sbin/nginx -s stop"
1
2
monit status nginx
monit summary nginx

4、参考