Nagios check_http는 HAProxy'd 사이트에 대해 'HTTP/1.0 503 서비스를 사용할 수 없음'을 제공합니다.

Nagios check_http는 HAProxy'd 사이트에 대해 'HTTP/1.0 503 서비스를 사용할 수 없음'을 제공합니다.

stackoverflow에서 이것을 요청했지만 여기에 더 적합하다고 생각합니다.

이건 알아낼 수 없어!

운영체제: CentOS 6.6 (최신)

check_httpHAProxy 1.5를 통해 제공되는 SSL 사이트를 쿼리하기 위해 nagios 검사(또는 컬)를 사용할 때 다음 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.0을 반환하고 다른 곳에서는 HTTP/1.1을 반환하는 것을 확인했습니다. 그렇다면 내 check_http플러그인이 이 문제를 일으키는 걸까요, 아니면 그게 원인일까요 curl?

내 서버가 HOST 헤더를 보내지 않는 것인가요? 그렇다면 어떻게 해결할 수 있습니까?

답변1

check_http에는 다음과 같은 옵션이 있습니다.--sni

해당 옵션을 사용해야 합니다

답변2

URL에 "-u" 옵션을 넣으려고 했나요? IP 주소와 호스트 이름도 사용했습니다. 나는 또한 HAProxy를 가지고 있으며 처음에 당신과 같은 메시지를 받았습니다.

나는 다음 명령을 사용했습니다.

./check_http -H example.com -I 8.8.8.8 -p 80 -u http://example.com/

이제 일이 끝났습니다!

답변3

이 문제를 해결하는 방법은 다음과 같습니다!

/usr/local/nagios/etc/objects/commands.cfg를 편집하고 https arument를 변경해야 합니다."-I"를 "-H"로

이는 서버 구성의 http_check 블록에 지정된 dip 주소 대신 호스트 이름을 조회하도록 지시합니다: /usr/local/nagios/etc/servers/yourserver.cfg

에서:

    # 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }

에게:

    # 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
        }

관련 정보