×


Nagios error Service check timed out after n Seconds

Are you facing Service check timed out after n Seconds NCPA error?

This guide is for you.


Sometimes our customers using the Nagios XI server report that they get this NCPA error.

This is generally as a result of timeout issues.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to deal with related Nagios error.

In this context, we shall look into methods to resolve this NCPA error.


How to resolve NCPA: Service check timed out after n Seconds ?

We can see various types of time outs and the method to fix them:


1. Nagios XI check_xi_ncpa Timeout

This timeout is how long the check_xi_ncpa command on the Nagios XI server will wait for a response from the NCPA agent.

By default, the timeout is not set, thereby defaulting to the plugin timeout or the global timeout.

We can fix this type of timeout using the following steps:

1. In the Nagios XI web interface, navigate to Configure

2. Then take Core Config Manager and go to Commands.

3. In the Commands page, use the Search field to search for ncpa and click Search.

4. After that, click the check_xi_ncpa command.

5. Now we can change the timeout in Nagios XI with the switch -T in the check_xi_ncpa command.

6. In the Command Line, add -T <time value in seconds> after $HOSTADDRESS$. Ex. -T 120

7. Finally, save the changes and then click the Apply Configuration button.


2. NCPA Client Timeout

This timeout is how long the NCPA client on the Nagios XI server will wait for a response from the plugin it executes before returning a result to Nagios XI.

Changing the settings in the remote host's /usr/local/ncpa/etc/ncpa.cfg file depending on how high we set the timeout in Nagios XI will fix this issue.

We can edit the file following command:

vi /usr/local/ncpa/etc/ncpa.cfg

On Windows we can use the following command:

C:\program file(x86)\nagios\ncpa\etc\nagios.cfg

And search for the plugin_timeout= for altering.

We can set this, at a minimum value of the timeout in Nagios XI and increase the plugin_timeout to match it.


3. Nagios XI Global Timeout

Nagios XI, by default, has a global timeout for host (30 seconds) and service (60 seconds) check commands.

This means if we have to change the check_xi_ncpa command timeout in Nagios XI with the switch -T to 120, Nagios XI will not wait for 120 seconds to pass, the global timeout will stop at 60 seconds.

To adjust the global timeout we can do the following:

1. First, navigate to Configure and take Core Config Manager

2. Then go to CCM Admin and take Core Configs.

3. In the Core Configs page we can see that by default the General [nagios.cfg] tab is selected.

Following are the two directives to change:

host_check_timeout=30
service_check_timeout=60

4. Finally, click Save Changes to update these settings and then Apply Config via Quick Tools.


Some basics to know before changing Timeouts in Nagios

Generally, we may get a thought of changing all the timeouts to 120 seconds. However, it is not as simple as that, we need to take into account that each layer of timeout needs to take into account the previous layer.

If the Nagios XI global timeout was set to 120 seconds and the NCPA was plugin_timeout=120 then it may take a whole second before it gets to NCPA.  

Here is an example of the "layers" we have to consider before changing:

1. Nagios XI Global Timeout 120

2. check_xi_ncpa timeout on Nagios XI server 119

3. plugin_timeout= on NCPA Client 118


[Need urgent assistance in fixing Nagios errors? We can help you. ]


Conclusion

This article covers how to resolve 'Service check timed out after n Seconds' error for our customers.

You can increase the timeout on the check, though you will have to alter the check in XI and the plugin timeout in the ncpa.cfg file on the remote host.


If it is related to Nagios XI check_xi_ncpa Timeout:

This timeout is how long the check_xi_ncpa command on the Nagios XI server will wait for a response from the NCPA agent. 

By default the timeout is not set, thereby defaulting to the plugin timeout or the global timeout.

1. In the Nagios XI web interface navigate to Configure > Core Config Manager > Commands. 

2. This brings up the Commands page, use the Search field to search for ncpa and click Search.

3. Click the check_xi_ncpa command.

4. You can change the timeout in Nagios XI with the switch -T in the check_xi_ncpa command.

5. In the Command Line, add -T <time value in seconds> after $HOSTADDRESS$. Ex. -T 120

6. Save your changes and then click the Apply Configuration button.