"Connection Refused" on local network

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
whitetree
Posts: 9
Joined: Wed Jan 11, 2012 12:38 pm

"Connection Refused" on local network

Post by whitetree »

I've got my Nagios server configured with two NICs. One is a 192.168.1.xx and the other is my public IP xx.xx.xx.xx My remote servers that are not in my local network have no problem connecting and talking to Nagios using the public IP address. However the Windows machines in my local network get a "Connection Refused" status wether or not I use the public IP or the internal IP address. I have added a firewall exception for port 12489 AND THE NSClient++/exe is running.

How do I troubleshoot this?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: "Connection Refused" on local network

Post by lmiltchev »

Did you add both IP addresses to the nsc.ini file (on this line)?

Code: Select all

allowed_hosts=
Note: After any change in the nsc.ini file, you must restart the nsclient++ service, so that the changes can take effect.

I would suggest testing it from the command line first. Run something simple from the command line and check the output, for example:

Code: Select all

# cd /usr/local/nagios/libexec
# ./check_nt -H <your_target_machine_IP_address> -s <your_password> -p 12489 -v MEMUSE -w 80 -c 90
Be sure to check out our Knowledgebase for helpful articles and solutions!
whitetree
Posts: 9
Joined: Wed Jan 11, 2012 12:38 pm

Re: "Connection Refused" on local network

Post by whitetree »

lmiltchev wrote:Did you add both IP addresses to the nsc.ini file (on this line)?

Code: Select all

allowed_hosts=
Note: After any change in the nsc.ini file, you must restart the nsclient++ service, so that the changes can take effect.

I would suggest testing it from the command line first. Run something simple from the command line and check the output, for example:

Code: Select all

# cd /usr/local/nagios/libexec
# ./check_nt -H <your_target_machine_IP_address> -s <your_password> -p 12489 -v MEMUSE -w 80 -c 90
Thanks for the quick reply. I did add both to the NSC.ini file and the command you suggested I run returned with [root@localhost libexec]# ./check_nt -H 192.168.1.9 -s <mypass> -p 12489 -v MEMUSE -w 80 -c 90
Connection refused
could not fetch information from server
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: "Connection Refused" on local network

Post by lmiltchev »

Can you telnet to port 12489 from your Nagios server?

Code: Select all

# telnet <target_machine_IP_address> 12489
Also, on your windows machine you can open a Command Prompt (Run->cmd.exe->Enter) and run:

Code: Select all

# netstat -an |find /i "listening" > c:openports.txt
You can then open the "openports.txt" file in a text editor and see if port 12489 is listening.
Be sure to check out our Knowledgebase for helpful articles and solutions!
whitetree
Posts: 9
Joined: Wed Jan 11, 2012 12:38 pm

Re: "Connection Refused" on local network

Post by whitetree »

lmiltchev wrote:Can you telnet to port 12489 from your Nagios server?

Code: Select all

# telnet <target_machine_IP_address> 12489
I cannot "connection refused"
lmiltchev wrote:Also, on your windows machine you can open a Command Prompt (Run->cmd.exe->Enter) and run:

Code: Select all

# netstat -an |find /i "listening" > c:openports.txt
You can then open the "openports.txt" file in a text editor and see if port 12489 is listening.
netstat does not show that the port is listening! even after I ran netsh to open the port with

Code: Select all

netsh firewall>set portopening tcp 12489
IMPORTANT: Command executed successfully.
I disabled the firewall completely and still cannot connect via telnet....
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: "Connection Refused" on local network

Post by scottwilkerson »

in your nsc.ini, in the [modules] section, make sure you have

Code: Select all

NSClientListener.dll
not

Code: Select all

;NSClientListener.dll
The NSClientListener.dll is what will listen on port 12489. If you make this change, restart the NSClient++ service and try again.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
whitetree
Posts: 9
Joined: Wed Jan 11, 2012 12:38 pm

Re: "Connection Refused" on local network

Post by whitetree »

scottwilkerson wrote:in your nsc.ini, in the [modules] section, make sure you have

Code: Select all

NSClientListener.dll
not

Code: Select all

;NSClientListener.dll
The NSClientListener.dll is what will listen on port 12489. If you make this change, restart the NSClient++ service and try again.
Done. Still not listening...

One thing that is striking me as different is that the machine in my local network is requesting administrative permission every time I start and stop the service, whereas my remote servers did not...

EDIT: I uninstalled NSClient++ and reinstalled it as the Domain Admin account instead of my sysadmin user account. 12489 port is now open, i can telnet to it. The error message in Nagios has now changed to "could not fetch information from server"
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: "Connection Refused" on local network

Post by lmiltchev »

When you run your check from the command line, do you use the same password as the one listed in the nsc.ini file? You can play around with this - changing and/or temporarily removing the password altogether.
Be sure to check out our Knowledgebase for helpful articles and solutions!
whitetree
Posts: 9
Joined: Wed Jan 11, 2012 12:38 pm

Re: "Connection Refused" on local network

Post by whitetree »

lmiltchev wrote:When you run your check from the command line, do you use the same password as the one listed in the nsc.ini file? You can play around with this - changing and/or temporarily removing the password altogether.
There is no password set for this machine as it is internal.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: "Connection Refused" on local network

Post by scottwilkerson »

whitetree wrote: There is no password set for this machine as it is internal.
Ludmil was referring to the passphrase in the nsc.ini and on the server. They need to share and use the same password
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked