[Nagiosplug-devel] check_tcp don't report state if connection is refused

Kei Sakamoto kay at kay-es.net
Fri May 14 05:05:21 CEST 2010

From: Thomas Guyot-Sionnest <dermoth at aei.ca>:

> > I found it is likely a bug in check_tcp. 
> > 
> > check_tcp connect to the host but the connection is refused, just
> > returned and no state was printed to stdout.
> > 
> > In check_tcp.c line 231, this problem may be caused here. No state message!
> > 
> >         result = np_net_connect (server_address, server_port, &sd, PROTOCOL);
> >         if (result == STATE_CRITICAL) return STATE_CRITICAL;
> This is somewhat correct. Nagios cares about the return code, not the
> message.
> I believe np_net_connect() prints something; so we could look at it but
> we have to be careful as it could affect other plugins/programs...

Oh, I see how it is.

I did understand what you say and return codes are defined in Plugin API.

It's true that np_net_connect() prints error messge by
strerror(errno), but check_tcp prints diffrent message with two case,
connection was refused and no response. I confused...

I appreciate check_tcp also prints state message.

Thank you.

Kei Sakamoto
<kay at kay-es.net>

More information about the Devel mailing list