Monit이 MySQL을 감지할 수 없습니다.

Monit이 MySQL을 감지할 수 없습니다.

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/

우분투 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

답변1

타일러에 대한 답변다른 질문이것에 관해서:

Ubuntu 20.04 LTS에서는 pid-file과 소켓이 주석 처리된 것을 발견했습니다 /etc/mysql/mysql.conf.d/mysqld.cnf. 이 두 줄의 주석 처리를 제거한 다음 mysql을 다시 시작하고 service mysql restartmonit을 사용하여 service monit restartmonit를 사용하여 mysqld 프로세스를 성공적으로 모니터링할 수 있었습니다.

그것은 저에게 효과적이었습니다. 그런데 @Tyler에게 감사드립니다. (나는 거기에 공감하고 댓글을 달 수 없습니다)

관련 정보