linuxurlhttpsnagiosnagiosxi

How to configure https_check URL in nagios


I have installed Nagios (Nagios® Core™ Version 4.2.2) in Linux Server.I have written a JIRA URL check using check_http for HTTPS url.

It should get a response 200, but It gives response 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;;;

So I configured the same in the nagios configuration file.

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'
}

Now my JIRA server is down, But it is not reflected in the nagios check.The nagios response still shows HTTP code 302 only.

How to fix this issue?


Solution

  • You did not specify, but I assume you defined your command in the Nagios central server commands.cfgconfiguration file, but you also need to define a service in services.cfg as services use commands to run scripts.

    If you are running your check_httpcheck from a different server you also need to define it in the nrpe.cfg configuration file on that remote machine and then restart nrpe.

    As a side note, from the output you've shared, I believe you're not using the flags that the check_http Nagios plugin supports correctly. From your post:

    check_http -I xxx.xxx.xxx.com  -u https://xxx.xxx.xxx.com/secure/Dashboard.jspa -S CONNECT -e 'HTTP/1.1 302'
    

    From ./check_http -h:

    -I, --IP-address=ADDRESS
        IP address or name (use numeric address if possible to bypass DNS lookup).
    

    You are using a host name instead (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).
    

    You specified CONNECT