【问题标题】:Monit only using HTTP for HTTPS website仅使用 HTTP 监控 HTTPS 网站
【发布时间】:2016-04-27 16:14:54
【问题描述】:

我正在尝试通过 Monit 监控本地 Apache 实例上的 VHost。同一个域同时接受 http https 流量,所以我想同时监控两者。

此外,域解析到的 IP 会转到一个服务器,该服务器在当前 Apache 实例和另一个运行 Apache 的服务器之间进行负载平衡。我需要 Monit 来监控 local 实例,我希望避免在 /etc/hosts 文件中添加任何记录,所以我认为 Monits 配置设置 @987654321 @ 就足够了,我认为它是(只是监视 localhost,但将标头 Host 设置为 vhost 域)。

无论如何,我似乎遇到的主要问题是,即使我将 Monit 配置为通过 httphttps 协议监视主机,它也会监视两个主机仅通过 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


    【解决方案1】:

    这里回复晚了,但我想我仍然会为偶然发现相同问题的读者发帖。

    尽管为 HTTPS 配置了检查,但问题似乎不在于使用端口 HTTP 的 Monit。它总是以状态报告 HTTP 协议(​​一个显示错误)。

    真正的问题可能在于 Monit 不支持 SSL 的 SNI,因此它会忽略您的 https 检查中的 with http headers [Host: www.domain.com ...。因此检查失败,因为 Monit 实际上正在测试 https://localhost

    我已向 Monit 开发人员 here 提交了错误。

    【讨论】:

    • 遇到了同样的问题。我希望这只是我做错了什么......显然不是,这只是monit的一个错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    • 2020-03-08
    • 2015-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多