Nagios not recognising HTTP Header

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
apteancloud
Posts: 47
Joined: Wed Sep 09, 2020 4:05 am

Nagios not recognising HTTP Header

Post by apteancloud »

I am trying to monitor a HTTPS URL which works from browser, but isnt giving me a output on Nagios.

Browser:
NagiosXIBrowser.JPG
From NagiosXI:

Code: Select all

[nagios@NagiosXIAzDev ~]$ /usr/local/nagios/libexec/check_http -H MYDOMAIN.com -f ok -u '/healthcheck?productName=MYPRODUCT&clientName=MYCLIENT' -S --sni -k 'token:TOKENID' -r 'status...Success'
HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 487 bytes in 0.176 second response time |time=0.176352s;;;0.000000 size=487B;;;0

Code: Select all

[nagios@NagiosXIAzDev ~]$ /usr/local/nagios/libexec/check_http -H MYDOMAIN.com -f ok -u '/healthcheck?productName=MYPRODUCT&clientName=MYCLIENT' -S --sni -k 'token:TOKENID' -r 'status...Success' -vvv
SSL initialized
GET /healthcheck?productName=MYPRODUCT&clientName=MYCLIENT HTTP/1.1
User-Agent: check_http/v2.3.3 (nagios-plugins 2.3.3)
Connection: close
Host: MYDOMAIN.com
Accept: */*
token:TOKENID


https://MYDOMAIN.com:443/healthcheck?productName=MYPRODUCT&clientName=MYCLIENT is 490 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Tue, 22 Jun 2021 17:21:06 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Strict-Transport-Security: max-age=15552000
CF-Cache-Status: DYNAMIC
cf-request-id: 0ad656816f00005a4bef29b000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 663726af1c925a4b-IAD
**** CONTENT ****
{"status":"Success","description":"Tests ran successfully"}
HTTP OK: HTTP/1.1 200 OK - 490 bytes in 0.656 second response time |time=0.655741s;;;0.000000 size=490B;;;0
You can see the Content is correct, yet it is complaining about incorrect pattern.
Also to add, the URL comes as https://MYDOMAIN.com:443, instead of https://MYDOMAIN.com. I dont want the port number to come across.
Not sure what is wrong here.
You do not have the required permissions to view the files attached to this post.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Nagios not recognising HTTP Header

Post by dchurch »

Those two commands solicited different results from the server each time.

Code: Select all

HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 487 bytes in 0.176 second response time |time=0.176352s;;;0.000000 size=487B;;;0

Code: Select all

HTTP OK: HTTP/1.1 200 OK - 490 bytes in 0.656 second response time |time=0.655741s;;;0.000000 size=490B;;;0
The first request returned 487 bytes, and the second one returned 490 bytes.

The reason it would say "pattern not found" is if the -r status...Success wasn't found in the response body. Such as if it returned {"status":"Error"}

Does it fail every time you run it, or is it intermittent?
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
apteancloud
Posts: 47
Joined: Wed Sep 09, 2020 4:05 am

Re: Nagios not recognising HTTP Header

Post by apteancloud »

I think this thread can be archived. No one chased me for this from my org, so I guess I have nothing to chase after either... :lol: :lol:
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Nagios not recognising HTTP Header

Post by dchurch »

Glad to hear you resolved it! Locking thread.

If you have any additional issues, feel free to make a new thread.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked