Nagios check_http muestra 'Servicio HTTP/1.0 503 no disponible' para el sitio HAProxy

Nagios check_http muestra 'Servicio HTTP/1.0 503 no disponible' para el sitio HAProxy

Pregunté esto en stackoverflow, pero creo que es más adecuado para aquí.

¡No puedo entender esto!

SO: CentOS 6.6 (actualizado)

Recibo el siguiente error 503 cuando uso mi check_httpverificación de nagios (o curl) para consultar un sitio SSL servido a través de HAProxy 1.5.

[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

Sin embargo. Puedo acceder perfectamente al sitio a través de cualquier navegador; (200 OK), y también curl -I https://example.comdesde otro servidor:

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;

El servidor HAProxy se ejecuta en pfSense 2.2.

Veo que HAProxy devuelve un HTTP/1.0 para nagios y HTTP/1.1 desde otro lugar. Entonces, ¿es mi check_httpcomplemento el que causa esto o no curl?

¿Mi servidor simplemente no envía el encabezado HOST? Si es así, ¿cómo puedo resolver esto?

Respuesta1

check_http tiene una opción llamada--sni

Necesitas usar esa opción.

Respuesta2

¿Intentaste poner la opción "-u" para la URL? También utilicé la dirección IP y el nombre de host. También tengo un HAProxy y el mismo mensaje que tú al principio.

Usé el comando:

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

¡Y ahora es trabajo!

Respuesta3

¡Aquí se explica cómo solucionar este problema!

Tienes que editar /usr/local/nagios/etc/objects/commands.cfg y cambiar el argumento https"-I" a "-H"

Esto le indicará que busque el nombre de host en lugar de una dirección dip especificada en su bloque http_check en la configuración del servidor: /usr/local/nagios/etc/servers/yourserver.cfg

de:

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

A:

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

información relacionada