# Var size limit in command.conf?

**URL:** <https://community.icinga.com/t/var-size-limit-in-command-conf/686>\
**Category:** Service Monitoring\
**Created:** [March 22, 2019, 11:53am UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686 "2019-03-22T11:53:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![liviodainatenacta](https://community.icinga.com/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liviodainatenacta](https://community.icinga.com/u/liviodainatenacta)\
**Post date:** [March 22, 2019, 11:53am UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/1 "2019-03-22T11:53:55Z")

</div>

Hi,  
im starting to migrate checks from icinga1 to icinga2  
i’ve implemented this command check and it return me that the service does not exist.  
if i change a service name like schedule it works, seems my service definition in server win is too long?  
this is the service name in win server: “edok.HyperDok-Acquisti.DokLabelserviceTenacta”  
i’ve inserted temporary in command.conf for debug reason, it works on icinga1, someone know if there is some limit regarding var length definition?  
regards, livio.

/\*  
command\_line $USER1$/check\_nt -H $HOSTADDRESS$ -p 1248 -v SERVICESTATE -l $ARG1$ -d SHOWALL  
\*/  
object CheckCommand “servicegenall” {  
import “plugin-check-command”  
command = [PluginDir + “/check\_nt”]  
arguments = {  
“-H” = {  
value = “$address$”  
description = “IP address or name.”  
required = true  
}  
“-p” = {  
value = “$port$”  
description = “service port.”  
required = true  
}  
“-v” = {  
value = “$servicestate$”  
description = “SERVICESTATE.”  
required = true  
}  
“-l” = {  
value = “edok.HyperDok-Acquisti.DokLabelserviceTenacta”  
description = “servicename.”  
required = true  
}  
“-d” = {  
value = “SHOWALL”  
description = “servicename showall.”  
required = true  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [March 22, 2019, 12:32pm UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/2 "2019-03-22T12:32:18Z")

</div>

Hi,

welcome to the Icinga community 🙂 You’re a little late for the migration party, but let’s try it nevertheless. I assume you have read the migration docs already?

While I agree that learning to migrate the command lines to proper 2.x syntax, you should also take into account that the Icinga 2 template library already may provide certain CheckCommand objects.

`check_nt` is covered by the monitoring plugins, and available inside the ITL as [nscp](https://icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#nscp). That being said, it is now key to extract the command line arguments and match them accordingly.

```auto
check_nt -H $HOSTADDRESS$ -p 1248 -v SERVICESTATE -l $ARG1$ -d SHOWALL

```

- HOSTADDRESS is simple, that already set by the CheckCommand itself, when no parameter is given
- -p 1248 is not the default port, but can be set as custom attribute `nscp_port`
- -v SERVICESTATE is mapped to `nscp_variable`
- -l $ARG1$ is the `nscp_params` attribute, whereas multiple values can be passed as array
- -d SHOWALL can be used by setting `nscp_showall` to true

Having that in mind, one can build a new host and service apply rule for that.

```auto
template "windows-host-template" {
  check_command = "hostalive"
}

object Host "windows-host" {
  import "windows-host-template"
  address = "..."
 
  vars.nscp_port = 1248 //set the port here, so that services don't need it. the command macro resolver detects that automatically.

  vars.os_type = "windows"
}

apply Service "windows-edok" {
  check_command = "nscp"

  vars.nscp_variable = "SERVICESTATE"
  vars.nscp_params = ["edok.HyperDok-Acquisti.DokLabelserviceTenacta"]
  vars.nscp_showall = true

  assign where host.vars.os_type == "windows"
}

```

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![liviodainatenacta](https://community.icinga.com/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liviodainatenacta](https://community.icinga.com/u/liviodainatenacta)\
**Post date:** [March 22, 2019, 1:19pm UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/3 "2019-03-22T13:19:47Z")

</div>

hi michael,  
thanks for you quicly reply, but the problem is not the syntax of the definition, the problem i think is the length of this service defined in windows and icinga2 seems have a tips when is so long, no problem with icing1 but this service name “edok.HyperDok-Acquisti.DokLabelserviceTenacta” it’s too long or it doent like some special char, if i change it with another service like “schedule” or “dnscache” it works fine. also if i try to execute command line check\_nt with all params it woks, so i think that icinga2 have some tips.  
regards, livio.

---

<div class="post-metadata">

**Author:** ![liviodainatenacta](https://community.icinga.com/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liviodainatenacta](https://community.icinga.com/u/liviodainatenacta)\
**Post date:** [March 22, 2019, 1:25pm UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/4 "2019-03-22T13:25:01Z")

</div>

icinga1 vs icinga2

 ![i1](https://community.icinga.com/uploads/default/original/1X/32257a761f473de61963bdb772867a15b872ebe9.jpeg) ![i2](https://community.icinga.com/uploads/default/original/1X/a85d698997df73ab8cd0c4584cbf6f4a65be8f56.jpeg)

rgs, livio

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [March 22, 2019, 1:37pm UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/5 "2019-03-22T13:37:10Z")

</div>

Hi,

can you share the manual check\_nt plugin call from your shell?

Cheers,  
Michael

---

<div class="post-metadata">

**Author:** ![liviodainatenacta](https://community.icinga.com/letter_avatar_proxy/v4/letter/l/e9bcb4/32.png) [@liviodainatenacta](https://community.icinga.com/u/liviodainatenacta)\
**Post date:** [March 25, 2019, 1:16pm UTC](https://community.icinga.com/t/var-size-limit-in-command-conf/686/6 "2019-03-25T13:16:37Z")

</div>

hi,  
i’ve solved installing an up2date version on windows box of the client.  
thank you.  
rgs, livio
