Page 1 of 1

check_HTTP shows incorrect status on CGI vs. command line

Posted: Tue Dec 03, 2019 1:36 pm
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.

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

Posted: Tue Dec 03, 2019 2:17 pm
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)