Page 1 of 1

check_http problem (very strange)

Posted: Tue Aug 13, 2013 5:25 am
by sikainfo
Hi there,

we do have a problem with a customized http check.

/usr/local/nagios/libexec/check_http -H XYZ.sika.com -S -u https://XYZ.sika.com/webconsole/app\?page=Login -p 443 -w 5 -c 10 -l

running this check with the test button in the CCM works fine

COMMAND: /usr/local/nagios/libexec/check_http -H XYZ.sika.com -S -u https://XYZ.sika.com/webconsole/app\?page=Login -p 443 -w 5 -c 10 -l
OUTPUT: HTTP OK HTTP/1.1 200 OK - 25519 bytes in 0.070 seconds |time=0.069714s;5.000000;10.000000;0.000000 size=25519B;0;0;0

running it on Unix commandline works fine
running it with NagiosXI brings following Error

(Return code of 127 is out of bounds - plugin may be missing)

Any clou ?

Re: check_http problem (very strange)

Posted: Tue Aug 13, 2013 9:25 am
by slansing
Hmm odd, what are the permissions on the plugin, and what is the path?

Re: check_http problem (very strange)

Posted: Wed Aug 14, 2013 1:22 am
by sikainfo
Below you find the path (standard) and the permissions which are set on this plugin:

-rwxr-xr-x 1 root root 468776 Apr 4 2012 /usr/local/nagios/libexec/check_http

this looks pretty standard and the same plugin runs fine against other windows Servers.

Re: check_http problem (very strange)

Posted: Wed Aug 14, 2013 10:08 am
by sreinhardt
Try altering the permissions to nagios.nagios:

Code: Select all

chown nagios.nagios /usr/local/nagios/libexec/check_http

Re: check_http problem (very strange)

Posted: Fri Aug 16, 2013 4:38 am
by sikainfo
As you see running the command from the same machine, after i changed the user and group like you proposed, did not change anything.

Running on system prompt:

Code: Select all

[root@chsismon1 ~]# /usr/local/nagios/libexec/check_http -H blackberry.sika.com -S -u https://blackberry.sika.com/webconsole/app\?page=Login -p 443 -w 5 -c 10 -m 25000:25600 -l -t 30
HTTP OK HTTP/1.1 200 OK - 25521 bytes in 0.080 seconds |time=0.079819s;5.000000;10.000000;0.000000 size=25521B;25000;0;0
Running through NagiosXI:
2013-08-16 11-30-36_Nagios XI.png

Re: check_http problem (very strange)

Posted: Fri Aug 16, 2013 12:39 pm
by lmiltchev
Have you tried wrapping the URL in single or double quotes? Can you post the service and command definition?

Re: check_http problem (very strange)

Posted: Mon Aug 19, 2013 10:10 am
by sikainfo
Hi,

below you find the service and command definitions: (before ai made the test with quoting the URL

Code: Select all

define command {
       command_name                             check_https_url
       command_line                             $USER1$/check_http -H $ARG8$ -S -u $ARG1$ -p $ARG2$ $ARG3$ $ARG4$ $ARG5$
 $ARG6$ $ARG7$

Code: Select all

###############################################################################
#
# Service configuration file
#
# Created by: Nagios QL Version 3.0.3
# Date:       2013-08-14 08:24:30
# Version:    Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios QL will overwite all manual settings during the next update
#
###############################################################################

define service {
        host_name                       chsismon1.ch.sika.com
        service_description             SYW-DA - CH - HTTPS NLS Connection
        use                             SIS-WindowsDC_nsclient_service
        check_command                   check_https_url!https://blackberry.sika.com/webconsole/app?page=Login&service=page!443!-w 5!-c 10!-m 25000:25600!-l!-t 30!blackberry.sika.com
        notifications_enabled           1
        icon_image                      Windows-DC.png
        register                        1
        }

###############################################################################
#
# Service configuration file
#
# END OF FILE
#
###############################################################################
then I made the test with Quoting and ..... it works in the normal UI! :o
but running the test under ccm and directly on the commandline it does not work.

Fine it works for me, but still why it is not constantly under all UI's ???? :roll:

Re: check_http problem (very strange)

Posted: Mon Aug 19, 2013 10:53 am
by abrist
The "test check command" in the CCM web ui has only limited privileges. It can only run tests as user apache, not as user nagios. Additionally, it does not have access to user defined macros.

Re: check_http problem (very strange)

Posted: Thu Aug 22, 2013 6:56 am
by sikainfo
I still not understand fully why, especially that fact that it runs without quoting and doesn't with quoting under Test and OS prompt, has not any link to the permissions of a User for me.
Anyway the problem is solved for me and you my close this thread.

Thank you

Andy

Re: check_http problem (very strange)

Posted: Thu Aug 22, 2013 9:37 am
by slansing
This is because it is not running your web UI under nagios, it is running it under Apache, so Apache has to be the one in the end who executes the checks done through the Test Check Command.