在安装monit后,当我做monit状态myproc我得到“错误连接到monit守护进程”
我在某处读过
如果monit在没有http支持的情况下运行indaemon模式,状态命令将不起作用 – 在这种情况下,命令“monit status”试图通过http / tcp从守护进程获取状态。 要启动http界面,您需要将“set httpd …”语句添加到configuration中。
那仍然是正确的? 那个职位是从2005年开始的
我努力在我的Ubuntu服务器上设置monit,这里有几件事要检查:
/ etc / monit / monitrc中的最后一个“gotcha”:
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)
首先我有“带启动延迟240”的线路未评论。 看来,如果你使用这个选项,httpd服务器不会立即启动。 我花了一段时间才明白为什么monit运行,但httpd服务器没有运行。
set httpd port 2812 and use address 0.0.0.0 allow 0.0.0.0/0.0.0.0 allow admin:monit
我觉得这样比较好,它会添加一个网页来查看monit的结果,而用户名和密码是admin和monit。
为了使这个工作,你必须设置monit httpd进程允许来自本地主机的连接。
在您的configuration文件中,您应该取消注释allow localhost并重新启动监视的行。
确保你已经启用了HTTP守护进程并添加了允许本地主机。 有一个关于如何正确configurationmonit以避免这个错误在这里写 。
我添加了这个线我的conf文件
set httpd port 2812 and use address localhost allow localhost
我得到了:无法创build套接字到[localhost]:2812 – 连接被拒绝
直到我重新启动虚拟机..如在Windows中:重新启动后安装监控好