Socket Timeouts and Connection Refused Errors

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mkeey
Posts: 199
Joined: Mon Sep 25, 2017 11:13 am

Socket Timeouts and Connection Refused Errors

Post 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
Last edited by benjaminsmith on Tue Feb 19, 2019 12:01 pm, edited 1 time in total.
Reason: images removed at request
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Socket Timeouts and Connection Refused Errors

Post 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.
Last edited by benjaminsmith on Tue Feb 19, 2019 12:01 pm, edited 1 time in total.
Reason: log removed at request
Be sure to check out our Knowledgebase for helpful articles and solutions!
mkeey
Posts: 199
Joined: Mon Sep 25, 2017 11:13 am

Re: Socket Timeouts and Connection Refused Errors

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Socket Timeouts and Connection Refused Errors

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
mkeey
Posts: 199
Joined: Mon Sep 25, 2017 11:13 am

Re: Socket Timeouts and Connection Refused Errors

Post 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
Last edited by benjaminsmith on Tue Feb 19, 2019 12:03 pm, edited 1 time in total.
Reason: code removed at request
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Socket Timeouts and Connection Refused Errors

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mkeey
Posts: 199
Joined: Mon Sep 25, 2017 11:13 am

Re: Socket Timeouts and Connection Refused Errors

Post 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
User avatar
rexconsulting
Posts: 60
Joined: Fri May 04, 2012 4:27 pm
Location: Oakland, CA
Contact:

Re: Socket Timeouts and Connection Refused Errors

Post 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.
CP
--
Chris Paul
Rex Consulting, Inc
5652 Florence Terrace, Oakland, CA 94611
email: [email protected]
web: http://www.rexconsulting.net
phone, toll-free: +1 (888) 403-8996 ext 1
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Socket Timeouts and Connection Refused Errors

Post 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

Code: Select all

nmap <windows ip> -p 12489
Can you try running both commands again, and show the output? Obfuscate sensitive info.
Last edited by benjaminsmith on Tue Feb 19, 2019 12:03 pm, edited 1 time in total.
Reason: log removed at request
Be sure to check out our Knowledgebase for helpful articles and solutions!
mkeey
Posts: 199
Joined: Mon Sep 25, 2017 11:13 am

Re: Socket Timeouts and Connection Refused Errors

Post by mkeey »

My apologies, I did run it as one command. Here are the results of the separated commands...
Last edited by benjaminsmith on Tue Feb 19, 2019 12:04 pm, edited 1 time in total.
Reason: output removed at request
Locked