Monit webinterfcae 显示:执行失败 | 不存在
netstat 给我的信息:
sudo netstat -lnp | grep mysql
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN 4643/mysqld
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 4643/mysqld
unix 2 [ ACC ] STREAM LISTENING 90220 4643/mysqld /var/run/mysqld/mysqlx.sock
unix 2 [ ACC ] STREAM LISTENING 90222 4643/mysqld /var/run/mysqld/mysqld.sock
和 monit -v(如果有帮助的话):
Process Name = mysqld
Group = mysql, database
Pid file = /var/run/mysqld/mysqld.pid
Monitoring mode = active
On reboot = start
Start program = '/etc/init.d/mysql start' timeout 30 s
Stop program = '/etc/init.d/mysql stop' timeout 30 s
Existence = if does not exist then restart
Depends on Service = mysql_rc
Depends on Service = mysql_bin
Port = if failed [localhost]:3306 type TCP/IP protocol MYSQL with timeout 15 s for 3 times within 4 cycles then restart
Unix Socket = if failed /var/run/mysqld/mysqld.sock type TCP protocol MYSQL with timeout 5 s for 3 times within 4 cycles then restart
Timeout = If restarted 5 times within 5 cycle(s) then unmonitor
File Name = mysql_bin
Group = mysql
Path = /usr/sbin/mysqld
Monitoring mode = active
On reboot = start
Existence = if does not exist then restart
Checksum = if failed defc97a98deb37905c97d9b5a09f9f13(MD5) then unmonitor
Permission = if failed 0755 then unmonitor
UID = if failed 0 then unmonitor
GID = if failed 0 then unmonitor
File Name = mysql_rc
Group = mysql
Path = /etc/init.d/mysql
Monitoring mode = active
On reboot = start
Existence = if does not exist then restart
Checksum = if failed 89a1a5b6ad710389112802fc3fbb81e1(MD5) then unmonitor
Permission = if failed 0755 then unmonitor
UID = if failed 0 then unmonitor
GID = if failed 0 then unmonitor
因此,即使 mysql 正在运行且处于活动状态,Monit 也无法检测到它。我使用以下命令设置符号链接:
sudo ln -s /etc/monit/conf-available/mysql /etc/monit/conf-enabled/
使用 Ubuntu 20.04
编辑 :
监控状态:
Process 'mysqld'
status Not monitored
monitoring status Not monitored
monitoring mode active
on reboot start
data collected Sun, 20 Dec 2020 00:00:29
File 'mysql_bin'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
permission 755
uid 0
gid 0
size 63.7 MB
access timestamp Mon, 21 Dec 2020 11:53:36
change timestamp Thu, 17 Dec 2020 11:52:00
modify timestamp Thu, 26 Nov 2020 12:03:42
checksum defc97a98deb37905c97d9b5a09f9f13 (MD5)
data collected Mon, 21 Dec 2020 16:32:35
File 'mysql_rc'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
permission 755
uid 0
gid 0
size 5.5 kB
access timestamp Mon, 21 Dec 2020 11:53:37
change timestamp Thu, 17 Dec 2020 11:52:05
modify timestamp Wed, 06 Nov 2019 18:34:43
checksum 89a1a5b6ad710389112802fc3fbb81e1 (MD5)
data collected Mon, 21 Dec 2020 16:32:35
监控日志显示如下,对我来说没什么异常。忽略邮件错误:
[UTC Dec 21 16:37:10] info : 'apache' monitor on user request
[UTC Dec 21 16:37:10] info : 'mysqld' monitor on user request
[UTC Dec 21 16:37:10] info : 'nginx' monitor on user request
[UTC Dec 21 16:37:10] info : 'inf-education-67' monitor on user request
[UTC Dec 21 16:37:10] info : 'apache_rc' monitor on user request
[UTC Dec 21 16:37:10] info : 'apache_bin' monitor on user request
[UTC Dec 21 16:37:10] info : 'mysql_rc' monitor on user request
[UTC Dec 21 16:37:10] info : 'mysql_bin' monitor on user request
[UTC Dec 21 16:37:10] info : 'nginx_rc' monitor on user request
[UTC Dec 21 16:37:10] info : 'nginx_bin' monitor on user request
[UTC Dec 21 16:37:10] info : Monit daemon with PID 900 awakened
[UTC Dec 21 16:37:10] info : Awakened by User defined signal 1
[UTC Dec 21 16:37:10] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:10] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials f77sm22188901wmf.42 - gsmtp
[UTC Dec 21 16:37:10] error : Alert handler failed, retry scheduled for next cycle
[UTC Dec 21 16:37:10] info : 'nginx_bin' monitor action done
[UTC Dec 21 16:37:11] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:11] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials y63sm24571380wmd.21 - gsmtp
[UTC Dec 21 16:37:11] error : Event queue is full
[UTC Dec 21 16:37:11] error : Aborting event - queue over quota
[UTC Dec 21 16:37:11] info : 'nginx_rc' monitor action done
[UTC Dec 21 16:37:11] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:11] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o125sm24541891wmo.30 - gsmtp
[UTC Dec 21 16:37:11] error : Event queue is full
[UTC Dec 21 16:37:11] error : Aborting event - queue over quota
[UTC Dec 21 16:37:11] info : 'mysql_bin' monitor action done
[UTC Dec 21 16:37:11] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:11] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials m2sm22734832wml.34 - gsmtp
[UTC Dec 21 16:37:11] error : Event queue is full
[UTC Dec 21 16:37:11] error : Aborting event - queue over quota
[UTC Dec 21 16:37:11] info : 'mysql_rc' monitor action done
[UTC Dec 21 16:37:11] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:11] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials s3sm2848477wmc.44 - gsmtp
[UTC Dec 21 16:37:11] error : Event queue is full
[UTC Dec 21 16:37:11] error : Aborting event - queue over quota
[UTC Dec 21 16:37:11] info : 'apache_bin' monitor action done
[UTC Dec 21 16:37:12] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:12] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 125sm22297314wmc.27 - gsmtp
[UTC Dec 21 16:37:12] error : Event queue is full
[UTC Dec 21 16:37:12] error : Aborting event - queue over quota
[UTC Dec 21 16:37:12] info : 'apache_rc' monitor action done
[UTC Dec 21 16:37:12] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:12] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o23sm30549332wro.57 - gsmtp
[UTC Dec 21 16:37:12] error : Event queue is full
[UTC Dec 21 16:37:12] error : Aborting event - queue over quota
[UTC Dec 21 16:37:12] info : 'inf-education-67' monitor action done
[UTC Dec 21 16:37:12] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:12] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials v20sm28999905wra.19 - gsmtp
[UTC Dec 21 16:37:12] error : Event queue is full
[UTC Dec 21 16:37:12] error : Aborting event - queue over quota
[UTC Dec 21 16:37:12] info : 'nginx' monitor action done
[UTC Dec 21 16:37:12] error : Mail: Mailserver response error -- 535-5.7.8 Username and Password not accepted. Learn more at
[UTC Dec 21 16:37:12] error : SMTP: Mailserver response error -- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials k1sm27935712wrn.46 - gsmtp
[UTC Dec 21 16:37:12] error : Event queue is full
[UTC Dec 21 16:37:12] error : Aborting event - queue over quota
[UTC Dec 21 16:37:12] info : 'mysqld' monitor action done