我具有以下服务定义:
define service{
use my-service ; Name of service template to use
host_name dra
service_description https://www.example.com
check_command check_http!-I my.ip.address --ssl -H www.example.com
notifications_enabled 1
retry_check_interval 2
normal_check_interval 5
contact_groups myadmins
}
服务检查始终失败,并>]
Name or service not known HTTP CRITICAL - Unable to open TCP socket
但是,如果我从命令行运行http_check,则会得到200 OK的结果:
/usr/lib/nagios/plugins/check_http -I my.ip.address --ssl -H www.example.com -v ..... HTTP OK: HTTP/1.1 200 OK - 9176 bytes in 0.074 second response time |time=0.073543s;;;0.000000 size=9176B;;;0
也请注意,所讨论的URL在浏览器中工作正常,证书有效,等等。我还对许多其他站点使用完全相同的服务定义,它们都工作正常。我唯一能想到的是,此远程主机在DigitalOcean上运行,并为其分配了“浮动IP”。我尝试用浮动IP地址或分配给主机的“标准” IP替换上面的
my.ip.address
(以及nagios配置文件的主机定义),这没有什么区别。
由nagios运行时,同一命令怎么可能失败,而手动运行时,成功吗?
我具有以下服务定义:define service {use my-service;要使用主机名的服务模板的名称dra service_description ...
我的问题的答案是:不要使用check_http
,请使用