# Timeout exceeded with nscp-local

**URL:** <https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380>\
**Category:** Icinga 2\
**Created:** [May 19, 2021, 9:38am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380 "2021-05-19T09:38:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![queoadmin](https://community.icinga.com/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@queoadmin](https://community.icinga.com/u/queoadmin)\
**Post date:** [May 19, 2021, 9:38am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/1 "2021-05-19T09:38:07Z")

</div>

Hi,

we have a check on some Windows-servers that can run very long (more than a minute).  
The check will be executed using nscp-local and, on the Windows-server, NSClient++  
As the server was checked per NRPE it worked without any problem with:

```
vars.nrpe_timeout = 180s
timeout = 180s

```

Now it times out after 60 seconds.  
I already tried to add timeout = 180s in the definition of nscp-local, but it didn’t helped.  
Any idea?

We use Icinga2 2.10.3-2 on a Debian 10 server from Debian repositories and Icinga2 2.11.3 on the Windows-server.

Thanks a lot  
Luca

---

<div class="post-metadata">

**Author:** ![ritzgu](https://community.icinga.com/letter_avatar_proxy/v4/letter/r/f19dbf/32.png) [@ritzgu](https://community.icinga.com/u/ritzgu)\
**Post date:** [May 19, 2021, 10:15am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/2 "2021-05-19T10:15:27Z")

</div>

Hi @queoadmin

does it help if you set the timeout in the local nsclient.ini?

```auto
[/settings/default]
timeout = 180
; ...
[/settings/external scripts]
timeout = 180

```

---

<div class="post-metadata">

**Author:** ![aclark6996](https://community.icinga.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@aclark6996](https://community.icinga.com/u/aclark6996)\
**Post date:** [May 19, 2021, 1:23pm UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/3 "2021-05-19T13:23:56Z")

</div>

Hello @queoadmin,  
I experience this problem too. Changing the timeout variable and the setting in the nsclient.ini file did not solve the problem. Setting the nscp\_boot variable to ‘false’ solved the time out error for me. The NSClient++ service should get set to running at startup for this to work.

```auto
vars.nscp_boot = false

```

I hope this help.  
Alex

---

<div class="post-metadata">

**Author:** ![queoadmin](https://community.icinga.com/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@queoadmin](https://community.icinga.com/u/queoadmin)\
**Post date:** [May 21, 2021, 9:36am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/4 "2021-05-21T09:36:51Z")

</div>

Hi Alex,

unfortunately it does not seem to help… ☹  
I always get Timeout exceeded after 60 seconds.

Any other idea?

Thanks  
Luca

---

<div class="post-metadata">

**Author:** ![Al2Klimov](https://community.icinga.com/user_avatar/community.icinga.com/al2klimov/32/959_2.png) [@Al2Klimov](https://community.icinga.com/u/Al2Klimov)\
**Post date:** [May 21, 2021, 10:50am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/5 "2021-05-21T10:50:05Z")

</div>

Sounds like:

> <https://github.com/Icinga/icinga2/issues/8703>
>
> \## Describe the bug
> 
> When a self-written plugin was executed and running in a …timeout, in the configuration of the service \`check\_timeout\` was set to \`3600\`. This had no effect as it was still timing out with the log message.
> \`\`\`
> \[2021-03-25 13:07:16 +0100\] warning/Process: Killing process group 70996 ('"C:\\Program Files\\ICINGA2\\sbin\\check\_failed\_sql.cmd"') after timeout of 60 seconds
> \`\`\`
> 
> As a second try we changed \`timeout\` on the checkcommand definition to \`120\` and then it did only timeout at \`120\` when provoking it by adding a sleep.
> 
> \## To Reproduce
> 
> 1. Create a plugin to run longer than the timeout defined (Powershell: Start-Sleep -s 120)
> 2. Create a CheckCommand for it
> 3. Create a Service which is run on a Windows system via check endpoint
> 4. Verify execution after timeout in Icinga Web 2 / Icinga 2's log
> 5. Add a check\_timeout to the Service bigger than the sleep
> 6. Verify execution after timeout in Icinga Web 2 / Icinga 2's log
> 7. Add a timeout to the CheckCommand bigger than the sleep but lower than the one on the Service
> 6. Verify execution after timeout in Icinga Web 2 / Icinga 2's log
> 
> \## Expected behavior
> 
> The attribute \`check\_timeout\` of a Service is honored like described in the docs.
> 
> \## Your Environment
> 
> \* Version used (icinga2 --version): 2.12.2 (Parent) / 2.11.2 (Agent)
> \* Operating System and version: RHEL 7 (Parent) / Windows 2019 (Agent)

I’d upgrade.

---

<div class="post-metadata">

**Author:** ![aclark6996](https://community.icinga.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@aclark6996](https://community.icinga.com/u/aclark6996)\
**Post date:** [May 21, 2021, 2:09pm UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/6 "2021-05-21T14:09:03Z")

</div>

I guess your problem was different than mine. My check script would finish in around 10 seconds when ran locally on the Windows server. The ‘nscp\_boot’ variable default value is set to ‘True’. From my understanding this would boot the NSClient application up and run the script. On my servers I have the NSClient++ application already in a running state at startup (no need to boot up). Because if this, my 10 second script would run longer than 60 seconds and I would receive timeout errors.

I guess your case is different. Your script runs locally longer than 60 seconds which is causing the timeout. No other suggestion from my end. I guess you need to look at writing a [custom check command](https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#integrate-the-plugin-with-a-checkcommand-definition) for your custom script.

Regards  
Alex

---

<div class="post-metadata">

**Author:** ![queoadmin](https://community.icinga.com/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@queoadmin](https://community.icinga.com/u/queoadmin)\
**Post date:** [May 26, 2021, 6:20am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/7 "2021-05-26T06:20:23Z")

</div>

Hi Alex,

Write a custom check command should not be a problem, but how can I increase the timeout in my custom command?  
I only know the same way for the “normal” check command. And I already tried to add `timeout = 180s` to the definition of `nscp-local`.

Thanks  
Luca

---

<div class="post-metadata">

**Author:** ![aclark6996](https://community.icinga.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@aclark6996](https://community.icinga.com/u/aclark6996)\
**Post date:** [May 26, 2021, 2:27pm UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/8 "2021-05-26T14:27:28Z")

</div>

When I say write a custom check command, I was meaning to NOT use the ‘nscp-local’ check command and write your own custom check command. See [here](https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#checkcommand) about setting up your own custom check command. You can set a custom time out attribute this way since your script normal runs longer than 60 seconds.

I hope this helps  
Alex

---

<div class="post-metadata">

**Author:** ![queoadmin](https://community.icinga.com/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@queoadmin](https://community.icinga.com/u/queoadmin)\
**Post date:** [May 27, 2021, 7:40am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/9 "2021-05-27T07:40:32Z")

</div>

Hi Alex,

what should the difference between “changing the settings for nscp-local” and “creating a new check using nscp.exe”?

Regards  
Luca

---

<div class="post-metadata">

**Author:** ![aclark6996](https://community.icinga.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@aclark6996](https://community.icinga.com/u/aclark6996)\
**Post date:** [June 1, 2021, 7:05pm UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/10 "2021-06-01T19:05:16Z")

</div>

You said earlier you already have a script that runs longer that 60 seconds. Instead or using the NSClient application (nscp-local check command using the NSClient application) to run the scripts with Icinga you could run the script stand alone.

@Al2Klimov provided a [link](https://github.com/Icinga/icinga2/issues/8703) to a NSClient timeout bug in older version of Icinga.

Write you own CheckCommand using your script and set the timeout to a larger value since NSClient is causing problems. A basic example of a [CheckCommand](https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#checkcommand) is below.

```auto
object CheckCommand "your_custom_script" {
  command = ["C:\\Program Files\\ICINGA2\\sbin\\your_custom_script.cmd"]

timeout = 5m
}

```

Alex

---

<div class="post-metadata">

**Author:** ![queoadmin](https://community.icinga.com/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@queoadmin](https://community.icinga.com/u/queoadmin)\
**Post date:** [June 7, 2021, 6:27am UTC](https://community.icinga.com/t/timeout-exceeded-with-nscp-local/7380/11 "2021-06-07T06:27:04Z")

</div>

Hi Alex,

Thank you for your answer.  
I’m trying to write the check, but I have some problem…  
I wrote:

> object CheckCommand “check\_eventlog” {  
> import “plugin-check-command”  
> command = ["C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -command "& ‘C:\Program Files\NSClient++\scripts\evtsumup3\query.ps1’" "]  
> arguments = {  
> “” = {  
> value = “$evlog\_server$”  
> order = -1  
> }  
> }  
> timeout = 180s  
> }

And I need to give the script a parameter, so I defined evlog\_server.  
Unfortunately when I try to check the service I get an error, since the parameter will be appended **after** the quote…

Could you suggest me how to correct the definition?

Thanks  
Luca
