我尝试使用自己的主厨和monit cookbook在我的服务器上配置monit。当我访问端口2812回复说this webpage is not available
时。这仅在通过Web浏览器远程访问时。我在本地卷曲时得到了预期的内容。
include_recipe 'monit'
cookbook_file '/etc/monit/conf.d/puma.conf' do
source 'monit-puma'
owner 'deploy'
group 'deploy'
mode '0755'
action :create
end
cookbook_file '/etc/monit/conf.d/nginx.conf' do
source 'monit-nginx'
owner 'deploy'
group 'deploy'
mode '0755'
action :create
end
execute 'sudo monit reload'
set httpd port 2812
use address 127.0.0.1
allow admin:mybestpassword
default['monit']['port'] = '2812'
default['monit']['username'] = 'admin'
default['monit']['password'] = '...'
default['monit']['address'] = '0.0.0.0'
default['monit']['allow'] = ['0.0.0.0']
monit 'monit' do
daemon_interval 30
event_slots 1000
httpd_port 2812
httpd_username 'admin'
httpd_password 'Password1'
group 'deploy'
end
monit 'monit' do
daemon_interval 30
event_slots 1000
httpd_port 2812
httpd_username 'admin'
httpd_password 'Password1'
group 'deploy'
end
monit_config 'nginx' do
source 'monit_nginx.conf.erb'
end
monit_config 'puma' do
source 'monit-puma.conf.erb'
end
# Generated by Chef for monit[monit]
SET PIDFILE /var/run/monit_real.pid
SET LOGFILE /var/log/monit.log
SET IDFILE /var/lib/monit/id
SET STATEFILE /var/lib/monit/state
SET EVENTQUEUE BASEDIR /var/lib/monit/events SLOTS 1000
SET HTTPD PORT 2812
ALLOW admin:Password1
INCLUDE /etc/monit/conf.d/*
答案 0 :(得分:1)
set httpd port 2812
use address 127.0.0.1
allow admin:mybestpassword
你只是在localhost(127.0.0.1)上听,所以很明显不会在远程通话中回答。
阅读monit cookbook自述文件(也是你链接的那个),有一个控制它的属性:
node['monit']['address'] – Local address to bind to for Monit's HTTPD interface. (default: nil)
在cookbook属性文件中设置default['monit']['address'] = '0.0.0.0'
,将其配置为侦听所有可用接口。
一个ACL允许每个文档中的注释,所以结局属性文件应该包括(未经测试):
default['monit']['address'] = '0.0.0.0'
default['monit']['allow'] = ['0.0.0.0']
答案 1 :(得分:1)
如README中所述,您需要为要使用的节点属性设置密码或allow
设置。否则他们会因安全而被忽略。您可以查看poise-monit
文档,了解有关配置Web UI的更多详细说明。