Page 1 of 2
Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 7:49 am
by mkeey
Have tried everything we can think of but we're getting a few Services with these two errors:
connect to address ######## and port 12489: Connection refused
and
Critical - Socket timeout
Have tried the following:
1. Reloaded software
2. Changed options on install
3. Added known good .ini file with added port settings
4. Ran netstat check
5. Checked ports with port query tool
6. Added exceptions to one server with firewall turn on. all other servers with issue, donot have firewall turned on.
7. Checked Nagios blogs
8. Adjusted time out settings from 10 - 30 seconds
See attached screen print.
Thanks,
Martin Keey
Re: Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 10:52 am
by lmiltchev
Make sure you have the following entries in the nsclient.ini file:
Save, exit and restart the NSClient++ service on the Windows box.
If this doesn't fix your issue, please post the entire nsclient.ini file on the forum. Obfuscate sensitive data.
Re: Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 1:11 pm
by mkeey
Added some lines that were missing. The error switch to the "could not fetch" error. So, we're closer!
Please note I changed the allowed hosts IP address to fictitious names.
# If you want to fill this file with all avalible options run the following command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
; Undocumented section
[/settings/default]
; Undocumented key
allowed hosts = host names
; Undocumented section
[/modules]
; Undocumented key
CheckExternalScripts = 1
; Undocumented key
CheckHelpers = 1
; Undocumented key
CheckNSCP = 1
; Undocumented key
CheckEventLog = 1
; Undocumented key
CheckDisk = 1
; Undocumented key
CheckSystem = 1
; Undocumented key
NSClientServer = 1
; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = 0
; PERFORMANCE DATA - Send performance data back to Nagios (set this to 0 to remove all performance data).
performance data = 1
; PORT NUMBER - Port to use for check_nt.
port = 12489
Re: Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 2:09 pm
by lmiltchev
Do you have hostnames (FQDN) or IPs on the "allowed hosts" line?
allowed hosts = host names
Did you check the
nsclient.log for clues (more info)?
Are you sure, this is not a firewall issue? Can you run the following commands in the CLI on the Nagios XI server, and show the output? Hide sensitive info.
Code: Select all
/usr/local/nagios/libexec/check_nt -H <windows ip> -p 12489 -s <password> -v CLIENTVERSION
nmap <windows ip> -p 12489
Re: Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 2:53 pm
by mkeey
Agent is in the same domain so there isn't a firewall involved.
Ran command from XI server. Change agent server's IP to "ServerIpAddr"....
Also, we did not define a user/password for the agents.
PS - Checked windows firewall and it is not active on the box. This is a Win2003 R2 SP2 server.
Forgot! Sorry about that... Seeing these errors in the Agent Log...
2018-08-03 15:58:43: error:c:\source\nscp\include\check_nt/server/protocol.hpp:67: Rejected connection from: NagiosXIServerIpAddr
Re: Socket Timeouts and Connection Refused Errors
Posted: Fri Aug 03, 2018 3:18 pm
by cdienger
Sorry if this seems redundant, but unless the variables are consistently used to hide sensitive info, we can't be sure the line has been updated correctly and the help from the nsclient site only points this as a being the cause of this message(
https://docs.nsclient.org/faq/).
Make sure to restart nsclient after making any changes to the .ini file. Without a restart, the old settings will continue to be used.
Re: Socket Timeouts and Connection Refused Errors
Posted: Mon Aug 06, 2018 10:30 am
by mkeey
Your statement: "restart the nsclient"
Reply... yes, we did that
Your question: "Does hostname == NagiosXIServerIpAddr"
Answer... Yes
Maybe this will be easier...
; Undocumented section
[/settings/default]
; Undocumented key
allowed hosts = ip addresses
; Undocumented section
[/modules]
; Undocumented key
CheckExternalScripts = 1
; Undocumented key
CheckHelpers = 1
; Undocumented key
CheckNSCP = 1
; Undocumented key
CheckEventLog = 1
; Undocumented key
CheckDisk = 1
; Undocumented key
CheckSystem = 1
; Undocumented key
NSClientServer = 1
; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = 0
; PERFORMANCE DATA - Send performance data back to Nagios (set this to 0 to remove all performance data).
performance data = 1
; PORT NUMBER - Port to use for check_nt.
port = 12489
Re: Socket Timeouts and Connection Refused Errors
Posted: Mon Aug 06, 2018 12:35 pm
by rexconsulting
I'm kind of wondering why anyone would use the unencrypted "check_nt" anymore, when NSClient++ works perfectly well in SSL mode with check_nrpe.
Re: Socket Timeouts and Connection Refused Errors
Posted: Mon Aug 06, 2018 12:54 pm
by lmiltchev
@mkeey, did you run this as one command?
These are two separate commands:
Code: Select all
/usr/local/nagios/libexec/check_nt -H <windows ip> -p 12489 -s <password> -v CLIENTVERSION
and
Can you try running both commands again, and show the output? Obfuscate sensitive info.
Re: Socket Timeouts and Connection Refused Errors
Posted: Mon Aug 06, 2018 1:42 pm
by mkeey
My apologies, I did run it as one command. Here are the results of the separated commands...