Var size limit in command.conf?

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
}
}
}

Hi,

welcome to the Icinga community :slight_smile: 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. That being said, it is now key to extract the command line arguments and match them accordingly.

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.

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

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.

icinga1 vs icinga2

rgs, livio

Hi,

can you share the manual check_nt plugin call from your shell?

Cheers,
Michael

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

1 Like