Page 1 of 1

http_check different port

Posted: Sat Jan 19, 2013 11:02 pm
by lesnikov
Hi,
I'm having problem with http_check. So this is my configuration.
I added this to commands.cfg

Code: Select all

define command{
         command_name    check_http_port
         command_line    $USER1$/check_http -H $ARG1$ -p $ARG2$
        }

and added host/service to test.cfg

Code: Select all

define host{
        use                     linux-server            ; Name of host template to use
        host_name               test
        alias                   test
        address                 10.0.0.222
        }
define service{
        use     local-service       ; Name of service template to use
        host_name                       test
        service_description             HTTP availability
        check_command           check_http_port!test!8080
         }
When i check status on Nagios it says:
Current Status:
CRITICAL
(for 0d 0h 48m 58s)
Status Information: Name or service not known
HTTP CRITICAL - Unable to open TCP socket
check_http works fine:
./check_http -H 10.0.0.222 -p 8080
HTTP OK: HTTP/1.0 302 Found - 425 bytes in 0.311 second response time |time=0.311228s;;;0.000000 size=425B;;;0
Can anyone tell me what I'm doing wrong?
thank you for your help.

Re: http_check different port

Posted: Tue Jan 22, 2013 4:31 am
by eltrasimaco
Maybe a permissions issue ...
exec the command with nagios user to see if it's ok

Re: http_check different port

Posted: Tue Jan 22, 2013 4:55 am
by gshergill
Hi lesnikov,

Your command definition has a slight issue.

It currently reads as follows:

Code: Select all

define command{
         command_name    check_http_port
         command_line    $USER1$/check_http -H $ARG1$ -p $ARG2$
        }
This should read:

Code: Select all

define command{
         command_name    check_http_port
         command_line    $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$
        }
Notice that the -H uses $HOSTADDRESS$ and -p is changed to $ARG1$.

Also, change the service definition to reflect this:

Code: Select all

define service{
        use     local-service       ; Name of service template to use
        host_name                       test
        service_description             HTTP availability
        check_command           check_http_port!8080
         }
This should work. Good luck!

Kind Regards,

Gary Shergill

Re: http_check different port

Posted: Tue Jan 22, 2013 2:23 pm
by slansing
If you get a chance, please let us know if this has resolved your issue. :)

Re: http_check different port

Posted: Thu Jan 24, 2013 3:01 pm
by lesnikov
ok it works now :)
thank you very much