安装 monit 后,当我执行 monit status myproc 时,我收到“连接到 monit 守护程序时出错”

Jas*_*Jas 6 linux monit

安装 monit 后,当我执行 monit status myproc 时,我收到“连接到 monit 守护程序时出错”

我在某处读到

如果 monit 在没有 http 支持的情况下运行 indaemon 模式,则 status 命令将不起作用 - 在这种情况下,命令“monit status”会尝试通过 http/tcp 从守护程序获取状态。要启动 http 接口,您需要在配置中添加“set httpd ...”语句。

那还是正确的吗?那个帖子是2005年的

小智 13

我正在努力在我的 ubuntu 服务器上设置 monit,这里有几件事要检查:

  • 确保在 /etc/default/monit 中设置了 startup=1
  • 确保取消注释 /etc/monit/monitrc 中的 httpd 参数

/etc/monit/monitrc 中的最后一个“陷阱”:

set daemon  120           # check services at 2-minute intervals
#  with start delay 240  # optional: delay the first check by 4-minutes (by
#                           # default Monit check immediately after Monit start)
Run Code Online (Sandbox Code Playgroud)

起初我没有注释“with start delay 240”行。如果使用此选项,httpd 服务器似乎不会立即启动。我花了一段时间才意识到为什么 monit 正在运行,而 httpd 服务器却没有。


小智 12

 set httpd port 2812 and
  use address 0.0.0.0
  allow 0.0.0.0/0.0.0.0
  allow admin:monit
Run Code Online (Sandbox Code Playgroud)

我觉得这样比较好,它会添加一个网页来查看monit结果,用户名和密码是admin和monit。