centos 安装和使用monit
monit 主要命令
# yum install monit
# monit -c /etc/monitrc
# monit quit
monit status
配置monit监控keepalived
[root@RTM monit.d]# ll
总用量 28
-rw-r--r-- 1 root root 173 3月 4 17:15 httpd
-rw-r--r-- 1 root root 183 3月 4 17:11 keepalived
-rw-r--r-- 1 root root 51 12月 27 2017 logging
-rw-r--r-- 1 root root 177 3月 4 17:27 mariadb
-rw-r--r-- 1 root root 246 3月 5 09:37 nsnrtmlicd
-rw-r--r-- 1 root root 200 3月 5 12:16 zabbix_agent
-rw-r--r-- 1 root root 201 3月 5 09:58 zabbix_server
[root@RTM monit.d]# pwd
/etc/monit.d
# 在keepalived文件里
配置如下
check process keepalived with matching "/usr/sbin/keepalived -D"
start program = "/usr/bin/bash -c 'systemctl start keepalived'"
stop program = "/usr/bin/bash -c 'systemctl stop keepalived'"