I have a service that defines some values for a command. The command executes a script, and the arguments are formatted as --argument=value. In my service, I define as vars.variable = [ "something" , "something_else" ]
.This argument is meant to be defined multiple times. I have set skip_key = true
and repeat_key = true
, but if I set value = "--argument=$variable$"
I get the error " Error: Mixing both strings and non-strings in macros is not allowed."
I’ve also tried value = "--argument=" + "$variable$".to_string()
as well, to no avail. I’m admittedly new to Icinga so any direction on this would be appreciated. Thanks.
you would need something like:
vars.variable = [ "something" , "something_else" ]
arguments = {
"--argument" = {
value = "$variable$"
description = "..."
repeat_key = true
}
}
https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#command-arguments-repeat-key
from the docs:
COMMAND ARGUMENTS: REPEAT KEY ¶
Parameters can use Array as value type. Whenever Icinga encounters an array, it repeats the parameter key and each value element by default.
command = [ NscpPath + "\\nscp.exe", "client" ]
arguments = {
"-a" = {
value = "$nscp_arguments$"
description = "..."
repeat_key = true
}
}
On a host/service object, specify the nscp_arguments custom variable as an array.
vars.nscp_arguments = [ "exclude=sppsvc", "exclude=ShellHWDetection" ]
This translates into the following command line:
nscp.exe 'client' '-a' 'exclude=sppsvc' '-a' 'exclude=ShellHWDetection'