I'm having a problem with Nagios XI whereby TCP client socket connections remain open indefinitely. In order to troubleshoot, I am running the VMware CENTOS package inside a VMPlayer environment.
Nagios seems to constantly try to open and close a connection apparently expecting the target socket to respond. If it does not, Nagios will continue to retry opening and closing on that same port. The existing connection attempts will remain “active” and do not close out. Because Nagios will continue to make attempts to connect, the Windows TCP/IP driver will start to “stack up” these “CLOSE_WAIT” connections over time.
The problem with this scenario, with enough multiple “CLOSE_WAIT” connections pending, is existing connections become destabalized. Existing traffic may halt and TCP network error conditions start occuring.
So the question I am trying to answer is:
"Is there a setting I can apply to Nagios in order to “timeout” and close sockets so that there isn’t an accumulation of leftover connection attempts which causes instability in the Windows TCP/IP driver."
check_tcp function issue
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_tcp function issue
In order to troubleshoot what you describe, could you send your configuration for the checks that are causing this behavior as I have never heard of this before?
check_tcp does have a -t flag where you can specify a timeout...
check_tcp does have a -t flag where you can specify a timeout...
Code: Select all
[root@localhost libexec]# ./check_tcp -h
check_tcp v1991 (nagios-plugins 1.4.13)
Copyright (c) 1999 Ethan Galstad <[email protected]>
Copyright (c) 1999-2008 Nagios Plugin Development Team
<[email protected]>
This plugin tests TCP connections with the specified host (or unix socke
Usage:check_tcp -H host -p port [-w <warning time>] [-c <critical time>]
[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]
[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-
[-D <days to cert expiry>] [-S <use SSL>] [-E]
Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-p, --port=INTEGER
Port number (default: none)
-4, --use-ipv4
Use IPv4 connection
-6, --use-ipv6
Use IPv6 connection
-E, --escape
Can use \n, \r, \t or \ in send or quit string. Must come before sen
Default: nothing added to send, \r\n added to end of quit
-s, --send=STRING
String to send to the server
-e, --expect=STRING
String to expect in server response (may be repeated)
-A, --all
All expect strings need to occur in server response. Default is any
-q, --quit=STRING
String to send server to initiate a clean close of the connection
-r, --refuse=ok|warn|crit
Accept tcp refusals with states ok, warn, crit (default: crit)
-M, --mismatch=ok|warn|crit
Accept expected string mismatches with states ok, warn, crit (defaul
-j, --jail
Hide output from TCP socket
-m, --maxbytes=INTEGER
Close connection once more than this number of bytes are received
-d, --delay=INTEGER
Seconds to wait between sending string and polling for response
-D, --certificate=INTEGER
Minimum number of days a certificate has to be valid.
-S, --ssl
Use SSL for the connection.
-w, --warning=DOUBLE
Response time to result in warning status (seconds)
-c, --critical=DOUBLE
Response time to result in critical status (seconds)
-t, --timeout=INTEGER
Seconds before connection times out (default: 10)
-v, --verbose
Show details for command-line debugging (Nagios may truncate output)