【发布时间】:2016-04-27 16:14:54
【问题描述】:
我正在尝试通过 Monit 监控本地 Apache 实例上的 VHost。同一个域同时接受 http 和 https 流量,所以我想同时监控两者。
此外,域解析到的 IP 会转到一个服务器,该服务器在当前 Apache 实例和另一个运行 Apache 的服务器之间进行负载平衡。我需要 Monit 来监控 local 实例,我希望避免在 /etc/hosts 文件中添加任何记录,所以我认为 Monits 配置设置 @987654321 @ 就足够了,我认为它是(只是监视 localhost,但将标头 Host 设置为 vhost 域)。
无论如何,我似乎遇到的主要问题是,即使我将 Monit 配置为通过 http 和 https 协议监视主机,它也会监视两个主机仅通过 http,但是使用 https 协议将端口设置为 443。
Apache 的 Monit 配置文件是:
check process httpd with pidfile /var/run/httpd/httpd.pid
start program = "/bin/systemctl restart httpd.service" with timeout 60 seconds
stop program = "/bin/systemctl stop httpd.service"
check host localhost with address localhost
if failed
port 80
protocol http
with http headers [Host: www.domain.com, Cache-Control: no-cache]
and request / with content = "www.domain.com"
then restart
if failed
port 443
protocol https
with http headers [Host: www.domain.com, Cache-Control: no-cache]
and request / with content = "www.domain.com"
then restart
if 5 restarts within 5 cycles
then timeout
这是该检查的监控状态:
[root@server enabled-monitors]# monit status localhost
The Monit daemon 5.14 uptime: 14m
Remote Host 'localhost'
status Connection failed
monitoring status Monitored
port response time FAILED to [localhost]:443/ type TCPSSL/IP protocol HTTP
port response time 0.001s to [localhost]:80/ type TCP/IP protocol HTTP
data collected Tue, 26 Apr 2016 10:44:32
所以对我来说很明显 https 失败了,因为它仍在尝试使用端口 HTTP,即使我在配置中有 protocol https。
任何意见将不胜感激。我觉得这可能是一个错误,并且会在 Monit Github 存储库中创建一个问题,但我不想确保这不是我忽略的愚蠢。
谢谢!
【问题讨论】:
标签: apache http https centos7 monit