Centos 7 安装并配置monit

Monit 是一个开源的linux 程序,用来监控程序,并且在必要的时候重启.

在centos上安装的非常的简单.

首先需要安装epel repo:

yum install epel-release

然后就可以安装monit了

yum install monit

将monit加入开机自启动并且start monit进程:

systemctl enable monit
systemctl start monit

查看monit 状态:

systemctl status monit

可以对monit做一个简单的配置,在centos7下,配置文件的路径是:

/etc/monitrc

对于需要监控的程序,配置的程序需要放在

/etc/monit.d/

监控named:

check process named with pidfile /var/run/named/named.pid
start program "/usr/bin/systemctl start named.service"
stop program "/usr/bin/systemctl stop named.service"
if failed host 127.0.0.1 port 53 type tcp protocol dns then restart
if failed host 127.0.0.1 port 53 type udp protocol dns then restart

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.