Command arguments

Hi,

I´m trying to pass arguments to a command.
When it´s passed like this:

object CheckCommand "nscp_api_cpu" {
    import "plugin-check-command"
    import "nscp_api_query"

    vars.nscp_api_arguments = [ "warn=load>$nscp_warn$", "crit=load>$nscp_crit$" ]
    vars.nscp_api_query = "check_cpu"
}

It´s working, but then I realized the “Arguments” Tab an tried it like this

object CheckCommand "nscp_api_cpu" {
    import "plugin-check-command"
    import "nscp_api_query"

    arguments += {
        crit = "load>$nscp_crit$"
        warn = "load>$nscp_warn$"
    }
    vars.nscp_api_query = "check_cpu"
}

What is wrong about that?

Thanks in advance!

That is two different “types” of arguments you configuring here.
In the first one you have a variable nscp_api_arguments, which is an array and holds information for the check.

In the second you have an (currently incorrect) definition of arguments. The arguments tab lets you define one or multiple parameters/arguments the check scripts needs to be executed correctly, e.g:
check_load -c 10,6,4 -w 5,4,3
Here the first parameter/argument is -c and it has its corresponding variables filled with 10,6,4

The command definition could look like this:

object CheckCommand "load" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_load" ]
    timeout = 1m
    arguments += {
        "-c" = {
            description = "Exit with CRITICAL status if load average exceed CLOADn; the load average format is the same used by 'uptime' and 'w'"
            value = "$load_cload1$,$load_cload5$,$load_cload15$"
        }
        "-w" = {
            description = "Exit with WARNING status if load average exceeds WLOADn"
            value = "$load_wload1$,$load_wload5$,$load_wload15$"
        }
    }
    vars.load_cload1 = 10
    vars.load_cload15 = 4
    vars.load_cload5 = 6
    
    vars.load_wload1 = 5
    vars.load_wload15 = 3
    vars.load_wload5 = 4
}

For your use case I would suggest that you create a service template for the cpu-check, not a new check command.
The Director should have the nscp_api check command already in its config if you have run the kickstart wizard previously:
http://your.ip.goes.here/icingaweb2/director/commands?type=external_object#!/icingaweb2/director/command/render?name=nscp_api

Use this check command, add the desired fields to the command (or the service template) and fill them with the information from your first example.
You will also (most likely) need to change the type of the nscp_api_arguments variable field to Array