如何在nagios中配置https_check URL
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在nagios中配置https_check URL相关的知识,希望对你有一定的参考价值。
我在Linux Server中安装了Nagios(Nagios®Core™版本4.2.2)。我使用check_http为HTTPS URL编写了一个JIRA URL检查。
它应该得到响应200,但它给出响应HTTP CODE 302。
[demuc1dv48:/pkg/vdcrz/Nagios/libexec][orarz]# ./check_http -I xx.xx.xx -u https://xxx.xxx.xxx.com/secure/Dashboard.jspa -S CONNECT
SSL Version: TLSv1
HTTP OK: HTTP/1.1 302 Found - 296 bytes in 0.134 second response time |time=0.134254s;;;0.000000 size=296B;;;
所以我在nagios配置文件中配置了相同的配置。
define command{
command_name check_https_jira_prod
command_line $USER1$/check_http -I xxx.xxx.xxx.com -u https://xxx.xxx.xxx.com/secure/Dashboard.jspa -S CONNECT -e 'HTTP/1.1 302'
}
现在我的JIRA服务器已关闭,但它没有反映在nagios检查中.nagios响应仍然只显示HTTP代码302。
如何解决这个问题?
答案
您没有指定,但我假设您在Nagios中央服务器commands.cfg
configuration文件中定义了您的命令,但您还需要在services.cfg
中定义服务,因为服务使用命令来运行脚本。
如果从不同的服务器运行check_http
check,还需要在该远程计算机上的nrpe.cfg
配置文件中定义它,然后重新启动nrpe
。
作为旁注,从你分享的输出中,我相信你没有使用check_http
Nagios插件正确支持的标志。从你的帖子:
check_http -I xxx.xxx.xxx.com -u https://xxx.xxx.xxx.com/secure/Dashboard.jspa -S CONNECT -e 'HTTP/1.1 302'
来自./check_http -h
:
-I, --IP-address=ADDRESS
IP address or name (use numeric address if possible to bypass DNS lookup).
您使用的是主机名(xxx.xxx.xxx.com)
-S, --ssl=VERSION
Connect via SSL. Port defaults to 443. VERSION is optional, and prevents auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).
你指定了CONNECT
另一答案
除非在chech_http脚本中设置follow
参数,否则无法获取代码200。
我建议你使用这样的东西:
./check_http -I jira-ex.telefonica.de -u https://xxx.xxx.xxx.com/secure/Dashboard.jspa -S -f follow
-f follow
对您的用例是强制性的。
以上是关于如何在nagios中配置https_check URL的主要内容,如果未能解决你的问题,请参考以下文章