check_HTTP shows incorrect status on CGI vs. command line

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
cc_10123
Posts: 1
Joined: Tue Dec 03, 2019 1:23 pm

check_HTTP shows incorrect status on CGI vs. command line

Post by cc_10123 »

I am trying to check for an expected string on HTTP. To troubleshoot, I executed this command:

Code: Select all

 /usr/lib/nagios/plugins/check_http -H 192.168.0.62 -u "/index.html" -s "qwerty"
and receive this response:

Code: Select all

HTTP CRITICAL: HTTP/1.1 200 OK - string 'qwerty' not found on 'http://192.168.0.62:80/index.html' - 11192 bytes in 0.001 second response time |time=0.001152s;;;0.000000;10.000000 size=11192B;;;0
However, when I include that same command in a service definition, it reports 'OK':

Code: Select all

define service{
        use                     custom-service
        host_name               myhostname
        service_description     flag1
        check_command           check_http! -u "/index.html" --string="qwerty"
        check_interval          1
        }
displayed via CGI:

Code: Select all

Service State Information
Current Status:	  OK   (for 0d 0h 13m 46s)
Status Information:	HTTP OK: HTTP/1.1 200 OK - 11192 bytes in 0.001 second response time
Performance Data:	time=0.001216s;;;0.000000;10.000000 size=11192B;;;0
What could be causing the command line and CGI output to show different values?

Thanks.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_HTTP shows incorrect status on CGI vs. command lin

Post by scottwilkerson »

Can you show the command definition for check_http

Also, can we verify in the resources.cfg that $USER1$ points to /usr/lib/nagios/plugins (making sure we don't have 2 different versions of the plugin installed)
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked