I create a socket on my .net application, listening on port 2001.
On Nagios i create a command with check_tcp using port 2001 and ip of my test machine.
I tested using telnet on another machine and i'm able to create the connection with my test machine using the ip and port 2001, but in nagios i receive these errors:
Host State Information
Host Status: DOWN
Status Information: CRITICAL - Host Unreachable
and
Service State Information
Current Status: UNKNOWN
Status Information: check_tcp: Port must be a positive integer
Does anyone knows what may be?
Problem with check_tcp
Problem with check_tcp
Last edited by Vecthor on Thu Nov 10, 2011 2:22 pm, edited 1 time in total.
Re: Problem with check_tcp
Hi,
maybe you have an error in your configuration.
Check the port on command line :
$ /usr/local/nagios/libexec/check_tcp -H yourserver -p 2001
If the exit code is correct, you must verify the configuration.
Could you post here the command and the service definition?
I think it looks like this:
Command ->
Service definition ->
Regards
Ivan
maybe you have an error in your configuration.
Check the port on command line :
$ /usr/local/nagios/libexec/check_tcp -H yourserver -p 2001
If the exit code is correct, you must verify the configuration.
Could you post here the command and the service definition?
I think it looks like this:
Command ->
Code: Select all
define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
Code: Select all
define service{
use generic-service
host_name yourserver
service_description My application [Port 2001]
check_command check_tcp!2001
}
Ivan
Re: Problem with check_tcp
I do a review, and it works - thank you ivan -, but now i'm trying to use the param -e:
$ /usr/local/nagios/libexec/check_tcp -H yourserver -p 2001 -e 1
At the first moment i returned 1 and at second moment i returned 0, but the status of this check_tcp doesn't change. I thought if i sent 1 to nagios, it shows ok, and if i sent 0 it shows warning... but doesn't change, i sent a large string and the nagios continue to show status ok.
What can i do to show warning in nagios using the param -e? Exists a way to do that?
$ /usr/local/nagios/libexec/check_tcp -H yourserver -p 2001 -e 1
At the first moment i returned 1 and at second moment i returned 0, but the status of this check_tcp doesn't change. I thought if i sent 1 to nagios, it shows ok, and if i sent 0 it shows warning... but doesn't change, i sent a large string and the nagios continue to show status ok.
What can i do to show warning in nagios using the param -e? Exists a way to do that?
Re: Problem with check_tcp
Hi,
I tried the parameter -e on different ports.
I used verbose modality for identify exactly the output:
With 1 or 0 the check is OK, I tried with 144 and the plugin show a warning.
Try with parameter -v and see the output. Maybe in your output there are both 1 and 0.
Probably, you should use a different value
Ivan
I tried the parameter -e on different ports.
I used verbose modality for identify exactly the output:
Code: Select all
$ ./check_tcp -H 127.0.0.1 -p 25 -e 144 -v
Using service TCP
Port: 25
flags: 0x2
server_expect_count: 1
0: 144
received 91 bytes from host
#-raw-recv-------#
220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Sat, 5 Nov 2011 20:53:30 +0100
#-raw-recv-------#
looking for [144] anywhere in [220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Sat, 5 Nov 2011 20:53:30 +0100]
couldn't find it
TCP WARNING - Unexpected response from host/socket: 220 localhost.localdomain ESMTP Sendmail 8.14.4/8.14.4; Sat, 5 Nov 2011 20:53:30 +0100|time=0.002820s;;;0.000000;2.000000
Try with parameter -v and see the output. Maybe in your output there are both 1 and 0.
Probably, you should use a different value
Ivan