如何在nagios中配置https_check URL

问题描述 投票:0回答:2

我在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。

如何解决这个问题?

linux url https nagios nagiosxi
2个回答
1
投票

您没有指定,但我假设您在Nagios中央服务器commands.cfgconfiguration文件中定义了您的命令,但您还需要在services.cfg中定义服务,因为服务使用命令来运行脚本。

如果从不同的服务器运行check_httpcheck,还需要在该远程计算机上的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


1
投票

除非在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对您的用例是强制性的。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.