http_check different port

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
lesnikov
Posts: 28
Joined: Sat Jan 19, 2013 10:40 pm
Location: Slovenia

http_check different port

Post 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.
Last edited by lesnikov on Fri Jan 25, 2013 6:42 am, edited 1 time in total.
eltrasimaco
Posts: 75
Joined: Thu Aug 02, 2012 7:15 am

Re: http_check different port

Post by eltrasimaco »

Maybe a permissions issue ...
exec the command with nagios user to see if it's ok
User avatar
gshergill
Posts: 231
Joined: Tue Aug 07, 2012 5:08 am

Re: http_check different port

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

Re: http_check different port

Post by slansing »

If you get a chance, please let us know if this has resolved your issue. :)
lesnikov
Posts: 28
Joined: Sat Jan 19, 2013 10:40 pm
Location: Slovenia

Re: http_check different port

Post by lesnikov »

ok it works now :)
thank you very much
Locked