Monit 将 Apache 列为不受监控

dun*_*nxd 11 monitoring monit apache-2.2

我刚刚根据monit 文档安装和配置了 monit。除 Apache 之外的所有服务都列为 Running,但 Apache 表示Not Monitored

monit 配置中的相关行是:

check process apache with pidfile /var/run/httpd.pid
        group www
        start program = "/etc/init.d/httpd start"
        stop program = "/etc/init.d/httpd stop"
        if failed host localhost port 80
        protocol http then restart
        if 5 restarts within 5 cycles then timeout
Run Code Online (Sandbox Code Playgroud)

我可以从服务器访问http://localhost/server-statushttp://localhost。Monit 将 Apache 的监控模式列为active

服务器正在运行 CentOS 5.4。

PID 文件对于父 httpd 服务器是正确的:

[server ~]$ cat /var/run/httpd.pid
2905
[server ~]$ ps auxc | grep httpd
root      2905  0.0  0.9  26952  4808 ?        Ss   11:36   0:00 httpd
Run Code Online (Sandbox Code Playgroud)

cjc*_*cjc 14

确保 pid 文件的内容与 Apache 主进程的 pid(即httpd以 root 身份运行的进程)匹配。pid 文件可能已过时。

如果它已经过时,请获取 Apache 主进程的 pid,然后执行类似的操作echo 1234 > /var/run/httpd.pid,有1234问题的 pid 在哪里。

之后,运行monit monitor apache以重新启动对该服务的监视。

  • PID 文件是正确的,但是运行`monit monitor apache` 可以启动它,现在重新启动服务后它似乎工作正常。我还应该尝试单击 Web 界面上的“启用监视器”按钮。 (2认同)