Nagios 12489 connection refused – Let us fix it
Are you stuck with the Nagios error 12489 connection refused?
The connection refused error occurs due to port block or improper configuration of NSClient.
At Bobcares, we often get requests to fix Nagios errors as part of our Server Management Services.
Today, let’s have a look at the reasons for this error. We’ll also see how our Support Engineers fix this error.
Why does Nagios show the 12489 connection refused?
NSClient program is a simple monitoring daemon, that is used to collect, receive, and distribute data metrics to Nagios monitoring tool.
The default port used by check_nt and NSClient is port 12489. The connection problem usually occurs due to different reasons like,
- Windows not listening on the port 12489 or blocked by the firewall.
- Disabling NSClient server in the nsclient.ini file.
- Disabling essential NSClient modules.
For instance, the error appears as follows.
How we fix the Nagios error?
At Bobcares, we have more than a decade of expertise in managing servers, we see customers’ facing Nagios errors. Now, let’s see how our Support Engineers fix this error.
Open port 12489
Recently, one of the customers got the Nagios 12489 connection refused error. Usually, the error occurs if the Windows firewall blocks the port or if the NSClient service does not listen on port 12489.
So, on the Windows host, we run the command.
netstat -an | find "12489"
We found that the port was not listening. So that we opened the port 12489 in the server firewall.
We also ensured that the firewall is allowing inbound connections to port 12489 as well.
Enable NSClient server
The same error can also happen due to missed entries in the configuration file nsclient.ini.
The check_nt command uses the NSClientServer parameter in the NSCLient++ agent. However, it was disabled in the nsclient.ini file.
We then added the following entry in the nsclient.ini file under the ‘[/modules]‘ section.
; NSClientServer - A server that listens for incoming check_nt connection and processes incoming requests. NSClientServer = 1
Then we saved the configuration file.
Finally, we restarted the NSClient++ agent on the server.
Thus the error was resolved.
Enable NSClient modules
Similarly, the absence of essential modules can result in this error.
One of our customers was trying to make NSClient++ to run on the XP box. The customer had configured nsc.ini file but the Windows don’t listen on the port 12489 and he was receiving the error.
So we checked configuration file nsc.ini. We found that there were no modules loaded.
Hence, we enabled the basic modules,
- NSClientListener.dll: This module accepts incoming NSClient requests and listens on port 12489.
- CheckSystem.dll: It handles checks like CPU load, process state, etc.
- CheckDisk.dll: This handles disc size checks and file status.
We enabled those modules by uncommenting the corresponding entries in the configuration file.
Finally, we restarted the service.
In addition, we check for other configuration settings like ALLOWED HOST ADDRESSES, NSCLIENT PORT NUMBER, etc. We ensure that these parameters are correctly defined in the nsc.ini file.
[Need assistance in fixing Nagios errors? – We’ll help you.]
In short, we fix the Nagios 12489 connection refused error by opening port 12489, tweaking check_nt command, enabling NSClient modules, etc. Today, we saw how our Support Engineers fixed this error.