我想用nagios检查SSL网站(https)的可用性。
我有一个命令添加到command.cfg:
define command{ command_name check_http_myserver_Demo command_line $USER1$/check_http -H www.mydomain.de -u /Demo -p 443 -S }
然后我在localhost.cfg中添加一个服务:
define service { use local-service host_name myServer service_description HTTP myserver Response Check check_command check_http_myserver_Demo max_check_attempts 2 normal_check_interval 5 retry_check_interval 1 notification_interval 240 notification_period 24x7 notification_options w,u,c,r }
如果我检查configuration文件“nagios -v nagios.cfg”我没有得到任何错误。
该服务的Nagios服务器检查是否定的,并说“HTTP关键 – Fehler beim Empfangen”(这是德语;我的翻译:“接收时出错”)。 但是该服务是可用的。 我可以打开一个浏览器,并可以打开的URL没有问题。
有任何想法吗?
编辑:
如果我手动运行检查,我会得到:
/usr/lib64/nagios/plugins/check_http -v -H www.c-onDocFlow.de -u / -S GET / HTTP/1.1 User-Agent: check_http/v1.4.15 (nagios-plugins 1.4.15) Connection: close Host: www.c-onDocFlow.de HTTP CRITICAL - Fehler beim Empfangen
没有“-S”它运行正常。 另外,如果我采取另一个(另一个域的)https方面没关系。 证书可能是错的,但我看不出有什么问题。
您可能无法看到其他任何错误,但我可以:
[me@risby]$ openssl s_client -connect www.c-onDocFlow.de:443 CONNECTED(00000003) [...] Certificate chain 0 s:/OU=Domain Control Validated/OU=PositiveSSL/CN=www.dbregio-nwn.de i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=PositiveSSL CA 2 1 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=PositiveSSL CA 2 i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root --- [much certificate stuff deleted] --- GET / <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>503 Service Temporarily Unavailable</title> </head><body> <h1>Service Temporarily Unavailable</h1> <p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</p> </body></html>
你说你可以通过浏览器从web服务器获得根页面没有问题( “该服务是可用的” ); 是否从NAGIOS服务器上获得了成功,我们能否看到一些证据? 目前,NAGIOS看起来很正确地告诉你,服务器根本没有提供任何内容。
您必须编辑/usr/local/nagios/etc/objects/commands.cfg并将https结构“-I”更改为“-H”
这将告诉它查找主机名,而不是在服务器configuration的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$ }