check_http problem (very strange)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
sikainfo
Posts: 105
Joined: Thu Mar 29, 2012 3:26 am

check_http problem (very strange)

Post 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 ?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_http problem (very strange)

Post by slansing »

Hmm odd, what are the permissions on the plugin, and what is the path?
User avatar
sikainfo
Posts: 105
Joined: Thu Mar 29, 2012 3:26 am

Re: check_http problem (very strange)

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_http problem (very strange)

Post by sreinhardt »

Try altering the permissions to nagios.nagios:

Code: Select all

chown nagios.nagios /usr/local/nagios/libexec/check_http
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
sikainfo
Posts: 105
Joined: Thu Mar 29, 2012 3:26 am

Re: check_http problem (very strange)

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_http problem (very strange)

Post by lmiltchev »

Have you tried wrapping the URL in single or double quotes? Can you post the service and command definition?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
sikainfo
Posts: 105
Joined: Thu Mar 29, 2012 3:26 am

Re: check_http problem (very strange)

Post 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:
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http problem (very strange)

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
sikainfo
Posts: 105
Joined: Thu Mar 29, 2012 3:26 am

Re: check_http problem (very strange)

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_http problem (very strange)

Post 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.
Locked