【问题标题】:Nagios check_http gives 'HTTP/1.0 503 Service Unavailable' for HAProxy siteNagios check_http 为 HAProxy 站点提供“HTTP/1.0 503 服务不可用”
【发布时间】:2015-02-18 14:44:23
【问题描述】:

想不出来这个!

操作系统:CentOS 6.6(最新)

使用我的 nagios check_http check(或 curl)查询通过 HAProxy 1.5 提供的 SSL 站点时,我收到以下 503 错误。

[root@nagios ~]# /usr/local/nagios/libexec/check_http -v -H example.com -S1
GET / HTTP/1.1
User-Agent: check_http/v2.0 (nagios-plugins 2.0)
Connection: close
Host: example.com


https://example.com:443/ is 212 characters
STATUS: HTTP/1.0 503 Service Unavailable
**** HEADER ****
Cache-Control: no-cache
Connection: close
Content-Type: text/html
**** CONTENT ****
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

HTTP CRITICAL: HTTP/1.0 503 Service Unavailable - 212 bytes in 1.076 second response time |time=1.075766s;;;0.000000 size=212B;;;0
[root@nagios ~]# curl -I https://example.com
HTTP/1.0 503 Service Unavailable
Cache-Control: no-cache
Connection: close
Content-Type: text/html

但是。我可以通过任何浏览器正常访问该站点(200 OK),也可以从另一台服务器访问curl -I https://example.com

root@localhost:~# curl -I https://example.com
HTTP/1.1 200 OK
Date: Wed, 18 Feb 2015 14:36:51 GMT
Server: Apache/2.4.6
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Pragma: no-cache
Last-Modified: Wed, 18 Feb 2015 14:36:52 GMT
Content-Type: text/html; charset=UTF-8
Strict-Transport-Security: max-age=31536000;

HAProxy 服务器正在 pfSense 2.2 上运行。

我看到 HAProxy 从其他地方为 nagios 和 HTTP/1.1 返回 HTTP/1.0。那是我的check_http' plugin causing this or is itcurl`吗?

我的服务器只是没有发送 HOST 标头吗?如果是这样,我该如何解决?

【问题讨论】:

    标签: http curl nagios haproxy pfsense


    【解决方案1】:

    check_http 的作用是检查服务器上是否存在index.html 文件。这意味着您可能有 http 正在运行和工作,而检查仍然失败。

    无论在服务器上创建index.html 文件是否能解决问题,您可能都不想创建这样的环境以使检查有效。

    我想设置一个检查来 ping 你的example.com 并通过 nrpe 检查你的 http 服务是否正在运行将满足你的要求。

    【讨论】:

    • 或添加--url=PATH 覆盖默认值。
    【解决方案2】:

    check_http 有一个名为--sni的选项

    您需要使用该选项

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多