【问题标题】:Monit process 'mysql' Not Monitored监控进程 'mysql' 未监控
【发布时间】:2015-03-12 09:58:58
【问题描述】:

任何想法为什么monit不会在这个设置中监控mysql? 我已经在这里找到了所有可以解决问题的方法,但无济于事。

这些是我的版本:

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty
mysql --version
Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.3
monit -V
This is Monit version 5.6

这两种设置我都试过了:

check process mysql with pidfile /var/run/mysqld/mysqld.pid
    group database
    start program = "/etc/init.d/mysql start"
    stop program = "/etc/init.d/mysql stop"
    #if failed host 127.0.0.1 port 3306 protocol mysql then restart
    if failed unixsocket /var/run/mysqld/mysqld.sock protocol MYSQL then restart

得到这个:

monit status
Process 'mysql'
  status                            Not monitored
  monitoring status                 Not monitored

可以确认:

/var/run/mysqld/mysqld.pid

读起来和

一样

ps -e | grep "mysql"

日志:

/var/log/monit.log

显示没有错误

Monit 以 root 身份运行:

ps -eaf | grep monit
root      4549     1  0 05:18 ?        00:00:00 /usr/bin/monit -c /etc/monit/monitrc
root      5248 12440  0 05:53 pts/0    00:00:00 grep --color=auto monit

【问题讨论】:

  • 在命令行中尝试monit monitor all。
  • 或者只是monit monitor mysql。
  • 对我来说,unix.stackexchange.com/questions/447212/… 的答案有帮助,即使用“then exec $script”而不是使用“then restart”“stop/start”程序。

标签: mysql linux ubuntu monit


【解决方案1】:

如前所述,应该这样做:

monit monitor mysql

有时“超时”语句会在重启错误过多的情况下禁用监控,我不建议使用这样的语句:

if X restarts within Y cycles then timeout

【讨论】:

    【解决方案2】:

    听起来像 monit 可能无法访问用户数据库组。

    ps -eaf | grep mysql 读到了什么?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多