Monit 似乎正在运行,但是当我转到端口 :2812 的 Web 界面时,我得到:
Not Found
There is no service by that name
monit 5.2.5
--
但 CLI 上一切似乎都正常
-->:/var/log$ sudo monit -t
Control file syntax OK
-->:/var/log$ sudo monit status
The Monit daemon 5.2.5 uptime: 11m
System 'system_mydomain.net'
status running
monitoring status monitored
load average [0.00] [0.01] [0.05]
cpu 0.0%us 0.0%sy 0.0%wa
memory usage 645520 kB [63.4%]
swap usage 213128 kB [10.1%]
data collected Wed Feb 15 06:27:26 2012
有任何想法吗?
答案1
以下是一个示例/etc/monit.conf
配置文件。请确保您的配置文件中包含类似于以“set httpd port 2812 and...”开头的行。
set daemon 60
set logfile syslog facility log_daemon
set idfile /tmp/monit.id
set statefile /tmp/monit.state
set mailserver localhost
set alert [email protected]
set httpd port 2812 and
#use address localhost # only accept connection from localhost
allow 172.16.16.0/255.255.255.0
allow localhost # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
check system Fruity
if loadavg (1min) > 6 then alert
if loadavg (5min) > 6 then alert
if memory usage > 90% then alert
if swap usage > 20% then alert
if cpu usage (user) > 90% then alert
if cpu usage (system) > 75% then alert
if cpu usage (wait) > 75% then alert
答案2
当我错误配置 Nginx 时,我遇到了这个错误。阅读维基百科,我解决了 monit 404 错误。这是我的 /etc/nginx/conf.d/monit.conf:
server {
listen 80;
server_name my.server.name;
location /monit/ {
allow 127.0.0.1;
allow 192.0.0.0/8;
deny all;
proxy_pass http://127.0.0.1:2812;
proxy_set_header Host $host;
rewrite ^/monit/(.*) /$1 break;
proxy_ignore_client_abort on;
}
}
答案3
我遇到了同样的问题,该网站位于 NGINX 代理后面。通过以下代码片段解决了:
location /monit/ {
rewrite ^/monit/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://127.0.0.1:2812;
proxy_redirect http://127.0.0.1:2812 /monit;
proxy_cookie_path / /monit/;
}