【问题标题】:Monit service name error监控服务名称错误
【发布时间】:2011-12-08 19:31:44
【问题描述】:

所以我的monitrc 文件中有以下内容:

check process apache with pidfile /usr/local/apache/logs/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host XXX port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu 80% for 5 cycles then restart
if totalmem 500 MB for 5 cycles then restart
if children 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout

但我不断收到以下错误:

Error: service name conflict, apache already defined '/usr/local/apache/logs/httpd.pid'

【问题讨论】:

    标签: mysql apache monit


    【解决方案1】:

    如果服务器的主机名是“apache”,则与监控系统负载的默认规则冲突。

    Monit 似乎有“检查系统主机名”的隐含规则,其中主机名是主机名命令的输出。

    你可以通过添加一行来覆盖它:

    check system newhostname
    

    例如:

    check system localhost
    

    【讨论】:

      【解决方案2】:

      当我忘记注释掉这一行时,我看到了这个错误:

      include /etc/monit/conf.d/*
      

      在自定义 /etc/monit/conf.d/myprogram.conf 文件中,因此它递归地包含该文件。

      【讨论】:

        【解决方案3】:

        您有没有机会在此条目下方或在单独的监控配置文件中有一个主机名为 apache 的条目?

        【讨论】:

          【解决方案4】:

          您多次定义了相同的服务。检查该服务的所有监控配置文件。这包括您的 monitrc 和“包含”部分下列出的所有文件(如 include /etc/monit/conf.d/*)。

          如果您在“包含”目录之一的文件中重新定义“包含”,则会遇到递归引用问题。

          【讨论】:

            【解决方案5】:

            非常非常重要的事情:你需要 monit 5.5 例如在 ubuntu 12.04 中仅在 repo 5.3 中可用

            所以你需要从其他 repo 下载和安装。 我的解决方案,例如:

            wget http://mirrors.kernel.org/ubuntu/pool/universe/m/monit/monit_5.5.1-1_amd64.deb && sudo dpkg -i monit_5.5.1-1_amd64.deb

            【讨论】:

              【解决方案6】:

              就我而言,我只需重新启动monit 即可消除服务名称错误:

              sudo service monit restart

              【讨论】:

                【解决方案7】:

                检查您是否在/etc/monit.d/ 目录下的任何monit conf 文件中定义的Apache 有任何冲突,我不小心为我的puma.conf 添加了nginx 并且之前遇到了同样的错误。

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 2018-10-01
                  • 2021-01-05
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 2018-12-18
                  • 1970-01-01
                  • 1970-01-01
                  相关资源
                  最近更新 更多