Connection refused

Started by jonesss, October 09, 2017, 05:09:31 PM

Previous topic - Next topic

jonesss

Hi all,

I've installed NetXMS 2.1.1 on a 32 bit Windows 7 OS.  I have run through the configuration wizard and set up a MySQL database (version 5.7.19).  After restarting my system, I get "Connection refused:  connect".  I've seen several posts on this and have tried stopping the core service, running nxdbmgr check and nxdbmgr unlock, and restarting the core service.  This has not solved the issue.  In my log file I see a lot of "Duplicate entry 'nnnn' for key 'PRIMARY'.  I'm hoping someone here can point me in the right direction.  I would really love to get this running again. 

Victor Kirhenshtein

Hi,

are you sure "NetXMS Core" service is running? If yes, check that port 4701 is listening and that firewall exception for port 4701 or process netxmsd.exe is set.

Best regards,
Victor

jonesss

Hi Victor,

Thanks for the response.  My Windows firewall is off.  According to TaskManager, the NetXMSCore service is running.  The netxmsd process starts sucessfully whenever I try to launch the NetXMS GUI.  I attempted to ensure that NetXMS was listening on port 4701 by running nxshell -p 4701 (nxshell p 4701) and got the message:  Unable to create Java VM (JVM load failed). 

Victor Kirhenshtein

You can use netstat command for that:

netstat -an

and check for port 4701 in LISTEN state.

Best regards,
Victor

jonesss

Hi Victor,

netstat -an shows that I am listening on port 4700, but not 4701.  After running nxadm -i, and set ListenPort 4701, I receive the message:  Configuration variable ListenPort updated.  Which is fine, except that when I run netstat -an again, nothing has changed.  I'm still listening on 4700 but not 4701.  Running netxmsd:  get ListenPort returns ListenPort = 4701.  The NetXMSCore service is running, and obviously the netxmsd process is running.  I am still unable to login in to the localhost.  I receive the same error as before.  Any thoughts?

Victor Kirhenshtein

Port 4700 is an agent listen port. Seems that server is unable to open port for some reason. Check server log on startup - it should contain messages regarding opening ports. You can run it with debug level 4 for more diagnostic.

Best regards,
Victor

jonesss

Hi Victor,

Thanks for all the help.  Running netxmsd -D 4 gives quite a bit of information.  The ERROR message I found interesting was "Unable to bind socket 21784 in function: LocalAdminListener:  Only one usage of each socket address (protocol/network address/port) is normally permitted.  I stopped the NetXMSCore service and killed netxmsd process from taskmgr and I killed the socket 21784 using CurrPorts, ran nxdbmgr check, unlock, and relaunched NetXMSCore.  Connection still refused.  Rebooted.  Opened taskmgr and noticed that both the agent and NetXMSCore services were running.  The process netxmsd is also running.  Opened CurrPorts and saw that netxmsd is already bound to 21784.  Ran nxdbmgr check and saw the db was locked so I force broke the lock and launched the NetXMS GUI.  Same error.  Unable to bind socket to port 21784 in function LocalAdminListener...
Any idea how to get around that?

Victor Kirhenshtein

Seems you are trying to run two instances of netxmsd at the same time. Try to do the following:

1. Stop NetXMS core service
2. Make sure ports 4701 and 21784 are not listening
3. Run nxdbmgr check and remove lock if asked
4. Edit C:\NetXMS\etc\netxmsd.conf: add line
DebugLevel = 4
and set log file to file (if not set already):
LogFile = C:\NetXMS\log\netxmsd.log
(of course you can set different file name and path).
5. Start NetXMS core service
6. Check log file for startup messages and possible socket errors. You can also post log file here.

Best regards,
Victor


jonesss

Hi Victor,

I followed the steps outlined (except I put the log in a different place :) ) .  NetXMSCore was stopped, made sure 4701 and 21874 were not listening, ran nxdbmgr check and removed lock, added DebugLevel = 4 to netxmsd.conf, and started NetXMSCore.  Still received connection error.  Attached is the (slightly redacted) log file.  I could not see any indication of why I was unable to connect.

Tursiops

Hi,

Just comparing my startup logs with yours, it appears your server might be listening on the wrong port?

Here's an excerpt of my logs (just the Listening for lines):
[12-Oct-2017 13:37:25.750] [INFO ] Listening for SNMP traps on UDP socket 0.0.0.0:162
[12-Oct-2017 13:37:25.750] [INFO ] Listening for SNMP traps on UDP socket [::]:162
[12-Oct-2017 13:37:25.758] [INFO ] Listening for syslog messages on UDP socket 0.0.0.0:514
[12-Oct-2017 13:37:25.759] [INFO ] Listening for syslog messages on UDP socket [::]:514
[12-Oct-2017 13:37:25.764] [INFO ] Listening for client connections on TCP socket 0.0.0.0:4701
[12-Oct-2017 13:37:25.776] [INFO ] Listening for client connections on TCP socket [::]:4701
[12-Oct-2017 13:37:25.776] [INFO ] Listening for mobile device connections on TCP socket [::]:4747
[12-Oct-2017 13:37:25.776] [INFO ] Listening for mobile device connections on TCP socket 0.0.0.0:4747
[12-Oct-2017 13:37:25.776] [INFO ] Listening for agent connections on TCP socket 0.0.0.0:4703
[12-Oct-2017 13:37:25.776] [INFO ] Listening for agent connections on TCP socket [::]:4703


Your logs show that your server is listening for client connections on 4700, not 4701.
4700 is the port the NetXMS Agent listens on, not the server.

Cheers

jonesss

Hi Victor

Thanks for the continued support.  If I run get ListenPort from netxmsd, I get ListenPort = 4701.  I continue to see

[13-Oct-2017 10:17:42.862] [ERROR] Unable to bind socket to port 21784 in function LocalAdminListener: Only one usage of each socket address (protocol/network address/port) is normally permitted.

and

13-Oct-2017 10:17:46.002] [ERROR] Unable to bind socket to port 4700 in function ClientListener: Only one usage of each socket address (protocol/network address/port) is normally permitted.

regularly.  I have added the line ListenPort = 4701 to netxmsd.conf and the line ListenPort = 4700 to nxagentd.conf.  Per CurrPorts, none of the listed ports were in use before launching the NetXMS GUI.  I'm not even really concerned with agent communication at this point.  I just want to understand why I am unable to log into the application locally, on the machine it is installed on.  Any help is greatly appreciated.

Cheers,
Sam

Victor Kirhenshtein

Seems you messed agent and server ports. Please do the following:

1. Stop both server and agent.
2. Delete ListenPort line from both netxmsd.conf and nxagentd.conf
3. Run command
nxdbmgr set ClientListenerPort 4701
4. Start both client and server
5. Check in netxmsd.log that server is listening on port 4701

Best regards,
Victor

jonesss

Hi Victor,

You can chalk up another win.  That got it.  Thanks a bundle for the fix.

Cheers,
Sam