Command Argument will be handed over to a service even if the value isn´t set since icinga v2.12

Hi all,

maybe someone can give me a solution to this problem.
In my environment I´m doing the configuration with the icinga2 director module.

I´ve configured a command with different arguments since I´ve upgraded Icinga2 to v2.12.0 the command isn´t working anymore.

With inspect I can see some differences in the check call.

Old behavior:

‘//usr/lib/nagios/plugins/custom/check_http_curl’ ‘-C’ ‘’ ‘-c’ ‘45’ ‘-j’ ‘ARRAY’ ‘-u’ ‘MYURL’ ‘-w’ ‘30’

New behavior:

‘//usr/lib/nagios/plugins/custom/check_http_curl’ ‘-C’ ‘-c’ ‘45’ ‘-j’ ‘ARRAY’ ‘-u’ ‘MYURL’ ‘-w’ ‘30’

The value for the ‘-C’ Argument isn´t set for this Service but will be handed over without any value and so my check script fails. The old behavior was it will be handed over to the system call but with an empty value (’’), which was ok for my check script.

If I´m setting “skip key” to “yes” in the icinga2 director only the value will be parsed to the system call, so the script also fails if -C is required.

Thanks for your help!
Patrick

Both old and new behavior seem strange to me, tbh.
Can you show the command definition?

… and the host and service definitions?

Hi all,

this is the command definition from director preview tab:

object CheckCommand "linux-http-curl-status-custom" {
    import "plugin-check-command"
    import "command-template-linux"

    command = [ "/$PluginDirCustom$/check_http_curl" ]
    timeout = 118s
    arguments += {
        "-A" = "$HTTP_ACCOUNT_PASSWORD$"
        "-B" = "$HTTP_BROWSER_AGENT$"
        "-C" = {
            description = "Show details for command-line debugging"
            value = "$http_cipher$"
        }
        "-H" = "$http_header$"
        "-L" = {
            set_if = "$http_forward$"
            value = "yes"
        }
        "-N" = {
            set_if = "$http_noproxy$"
            value = "yes"
        }
        "-c" = {
            description = "Response time to result in critical status (seconds)"
            value = "$http_critical_time$"
        }
        "-d" = "$http_data$"
        "-h" = "$http_host$"
        "-j" = "$http_nocheck$"
        "-s" = {
            description = "String to expect in the content"
            value = "$http_string$"
        }
        "-u" = {
            description = "URL to GET or POST (default: /)"
            value = "$http_url$"
        }
        "-w" = {
            description = "Response time to result in warning status (seconds)"
            value = "$http_warn_time$"
        }
        "-x" = "$http_proxy$"
    }
    vars.check_address = {
        arguments = [  ]
        deprecated = false
        name = "<anonymous>"
        side_effect_free = false
        type = "Function"
    }
    vars.check_ipv4 = "$http_ipv4$"
    vars.check_ipv6 = "$http_ipv6$"
    vars.http_forward = true
    vars.http_invertregex = false
    vars.http_linespan = false
    vars.http_link = false
    vars.http_sni = false
    vars.http_verbose = false

For the -C Argument the Configuration looks like this:

The $http_cipher$ variable will be referenced in the host configuration but isnt set to any value in this case. But the -C parameter will be used in the command execution as shown before…

Thanks for your help!

Please share the host and service configs:

  • icinga2 object list -t host --name 'X'
  • icinga2 object list -t service --name 'X!Y'

Hi,

here is the configuration. I´ve deleted some variables because this is a productive server.

Object 'HOSTNAME' of type 'Host':
  % declared in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1618:1-1618:25
  * __name = "HOSTNAME"
  * action_url = ""
  * address = "IP"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1622:5-1622:28
  * address6 = ""
  * check_command = "hostalive"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 99:5-99:31
  * check_interval = 10
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 102:5-102:24
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 118:5-118:24
  * check_period = "24x7"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 101:5-101:25
  * check_timeout = 30
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 104:5-104:23
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 120:5-120:23
  * command_endpoint = ""
  * display_name = "HOSTNAME"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1621:5-1621:61
  * enable_active_checks = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 106:5-106:31
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 121:5-121:31
  * enable_event_handler = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 108:5-108:31
  * enable_flapping = false
  * enable_notifications = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 105:5-105:31
  * enable_passive_checks = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 107:5-107:32
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 122:5-122:32
  * enable_perfdata = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 109:5-109:26
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 123:5-123:26
  * event_command = ""
  * flapping_threshold = 0
  * flapping_threshold_high = 30
  * flapping_threshold_low = 25
  * groups = [ ]
  * icon_image = ""
  * icon_image_alt = ""
  * max_check_attempts = 3
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 100:5-100:28
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 117:5-117:28
  * name = "HOSTNAME"
  * notes = ""
  * notes_url = ""
  * package = "director"
  * retry_interval = 20
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 103:5-103:24
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 119:5-119:24
  * source_location
    * first_column = 1
    * first_line = 1618
    * last_column = 25
    * last_line = 1618
    * path = "/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf"
  * templates = [ "HOSTNAME", "host-template-linux", "host-template-linux-windows", "host-template-generic" ]
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1618:1-1618:25
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 1:0-1:34
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 114:1-114:43
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 98:1-98:37
    * DISK_PARTITION_ARRAY = [ "/", "/opt:10X::MB", "/var/opt/atlassian", "/var/lib/pgsql" ]
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 162:5-162:39
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 7:5-7:39
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1645:5-1650:5
    * DISK__DEVICE_ARRAY = [ "sda", "sdb" ]
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 163:5-163:39
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1651:5-1651:46
    * LOG_MESSAGE_CHECK = false
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 8:5-8:34
    * MAIL_TRANSPORT_AGENT = "postfix"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 9:5-9:41
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1655:5-1655:35
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/master/hosts.conf', lines 1658:5-1658:30
    * backup_logbasedir = "/"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 14:5-14:32
    * cluster_lag_critical = "4"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 168:5-168:35
    * cluster_lag_warning = "2"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 169:5-169:34
    * disk_cfree = "8%"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 170:5-170:26
    * disk_wfree = "12%"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 171:5-171:27
    * iostat_critical = "1000,120000,80000"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 15:5-15:46
    * iostat_warning = "900,100000,70000"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 16:5-16:44
    * load_crit = "0.95,0.90,0.80"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 17:5-17:37
    * load_warn = "0.90,0.80,0.70"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 18:5-18:37
    * ntp_address = "ntp1.dc.iso-hosting.net,ntp2.dc.iso-hosting.net"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 172:5-172:37
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 19:5-19:72
    * ntp_critical = "3"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 173:5-173:27
    * ntp_warning = "1"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 174:5-174:26
    * swap_critical = "9%"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 20:5-20:29
    * swap_io_critical = "200"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 21:5-21:33
    * swap_io_warning = "100"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 22:5-22:32
    * swap_warning = "13%"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 23:5-23:29
  * volatile = false
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/host_templates.conf', lines 124:5-124:20
  * zone = "master"

Here is the service configuration:

Object 'HOSTNAME!Linux URL Status URL' of type 'Service':
  % declared in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81
  * __name = "HOSTNAME!Linux URL Status URL"
  * action_url = ""
  * check_command = "linux-http-curl-status-custom"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 275:5-275:51
  * check_interval = 120
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 112:5-112:23
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 277:5-277:23
  * check_period = "24x7"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 111:5-111:25
  * check_timeout = null
  * command_endpoint = "HOSTNAME"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 120:5-120:32
  * display_name = "Linux URL Status URL"
  * enable_active_checks = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 115:5-115:31
  * enable_event_handler = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 117:5-117:31
  * enable_flapping = false
  * enable_notifications = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 114:5-114:31
  * enable_passive_checks = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 116:5-116:32
  * enable_perfdata = true
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 118:5-118:26
  * event_command = ""
  * flapping_threshold = 0
  * flapping_threshold_high = 30
  * flapping_threshold_low = 25
  * groups = [ ]
  * host_name = "HOSTNAME"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81
  * icon_image = ""
  * icon_image_alt = ""
  * max_check_attempts = 6
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 110:5-110:28
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 276:5-276:28
  * name = "Linux URL Status URL"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81
  * notes = ""
  * notes_url = ""
  * package = "director"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81
  * retry_interval = 120
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 113:5-113:23
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 278:5-278:23
  * source_location
    * first_column = 1
    * first_line = 632
    * last_column = 81
    * last_line = 632
    * path = "/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf"
  * templates = [ "Linux URL Status URL", "service-template-linux-http-status", "service-template-linux", "service-template-generic", "host var overrides (Director)" ]
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 272:1-272:53
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 22:1-22:41
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 109:1-109:43
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/001-director-basics.conf', lines 28:3-28:43
  * type = "Service"
  * vars
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/001-director-basics.conf', lines 41:7-41:51
    * CUSTOM_DISPLAYNAME = "Health URL"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 279:5-279:42
    * NOTIFICATION_INTERVAL = 600
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 121:5-121:36
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 280:5-280:36
    * NOTIFICATION_LEVEL = "HOSTSETTING"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 122:5-122:43
    * NOTIFICATION_PERIOD = "24x7"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 123:5-123:37
    * http_cipher = "$host.vars.HTTPS_CIPHERS$"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 636:5-636:50
    * http_critical_time = "45"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 281:5-281:34
    * http_nocheck = "ARRAY"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 637:5-637:31
    * http_noproxy = true
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 638:5-638:28
    * http_port = "$host.vars.APP_HTTP_PORT_01$"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 639:5-639:51
    * http_url = "URL"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 640:5-640:26
    * http_warn_time = "30"
      % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 282:5-282:30
  * volatile = false
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_templates.conf', lines 119:5-119:20
  * zone = "master"
    % = modified in '/var/lib/icinga2/api/packages/director/d3e487b7-90e5-4695-8f2b-83175d009923/zones.d/director-global/service_apply.conf', lines 632:1-632:81

The “http_cipher” variable is referenced to the a custom Host variable “$host.vars.HTTPS_CIPHERS$” which is not set in this host configuration. So I´m wondering why the -C argument will be set in the command execution…

Thanks for your help!
Patrick

Hi all,

It seems like the problem is caused because the $http_cipher$ variable will be filled by another referenced host variable. For some reason the argument will be applied even if the referenced variable is empty.

In my case this is a big problem. Is this a known behavior and are there any workarounds for this problem?

Thanks

Works for me:

➜  icinga2 git:(master) cat nestvar.conf
object CheckerComponent { }

object CheckCommand "lolcat" {
	command = [ "echo" ]
	arguments = {
		"a" = "$a$"
	}
}

object Host "lolcat" {
	check_command = "lolcat"
	vars.a = "$b$"
}
➜  icinga2 git:(master) prefix/sbin/icinga2 daemon -c nestvar.conf -x notice
[2020-08-27 11:20:01 +0200] information/cli: Icinga application loader (version: v2.12.0)
[2020-08-27 11:20:01 +0200] notice/cli: Spawning seemless worker process doing the actual work
[2020-08-27 11:20:01 +0200] notice/cli: Spawned worker process (PID 4451), waiting for it to load its config
[2020-08-27 11:20:01 +0200] information/cli: Loading configuration file(s).
[2020-08-27 11:20:01 +0200] notice/ConfigCompiler: Compiling config file: nestvar.conf
[2020-08-27 11:20:01 +0200] notice/ConfigCompiler: Compiling config file: /Users/aklimov/NET/WS/icinga2/prefix/var/lib/icinga2/api/packages/_api/include.conf
[2020-08-27 11:20:01 +0200] notice/ConfigCompiler: Compiling config file: /Users/aklimov/NET/WS/icinga2/prefix/var/lib/icinga2/api/packages/_api/fa1806d5-1b79-4918-9a7f-e071bf22a817/include.conf
[2020-08-27 11:20:01 +0200] notice/ConfigCompiler: Compiling config file: /Users/aklimov/NET/WS/icinga2/prefix/var/lib/icinga2/api/packages/_api/fa1806d5-1b79-4918-9a7f-e071bf22a817/../active.conf
[2020-08-27 11:20:01 +0200] information/ConfigItem: Committing config item(s).
[2020-08-27 11:20:01 +0200] notice/WorkQueue: Spawning WorkQueue threads for 'DaemonUtility::LoadConfigFiles'
[2020-08-27 11:20:01 +0200] information/ConfigItem: Instantiated 1 CheckCommand.
[2020-08-27 11:20:01 +0200] information/ConfigItem: Instantiated 1 Host.
[2020-08-27 11:20:01 +0200] information/ConfigItem: Instantiated 1 IcingaApplication.
[2020-08-27 11:20:01 +0200] information/ConfigItem: Instantiated 1 CheckerComponent.
[2020-08-27 11:20:01 +0200] information/ScriptGlobal: Dumping variables to file '/Users/aklimov/NET/WS/icinga2/prefix/var/cache/icinga2/icinga2.vars'
[2020-08-27 11:20:01 +0200] notice/WorkQueue: Stopped WorkQueue threads for 'DaemonUtility::LoadConfigFiles'
[2020-08-27 11:20:01 +0200] notice/cli: Notifying umbrella process (PID 4437) about the config loading success
[2020-08-27 11:20:01 +0200] notice/cli: Worker process successfully loaded its config
[2020-08-27 11:20:01 +0200] notice/cli: Waiting for the umbrella process to let us doing the actual work
[2020-08-27 11:20:01 +0200] notice/cli: The umbrella process let us continuing
[2020-08-27 11:20:01 +0200] information/ConfigObject: Restoring program state from file '/Users/aklimov/NET/WS/icinga2/prefix/var/lib/icinga2/icinga2.state'
[2020-08-27 11:20:01 +0200] notice/WorkQueue: Spawning WorkQueue threads for 'ConfigObject::RestoreObjects'
[2020-08-27 11:20:01 +0200] information/ConfigObject: Restored 4 objects. Loaded 1 new objects without state.
[2020-08-27 11:20:01 +0200] notice/WorkQueue: Stopped WorkQueue threads for 'ConfigObject::RestoreObjects'
[2020-08-27 11:20:01 +0200] notice/ConfigCompiler: Compiling config file: /Users/aklimov/NET/WS/icinga2/prefix/var/lib/icinga2/modified-attributes.conf
[2020-08-27 11:20:01 +0200] information/ConfigItem: Triggering Start signal for config items
[2020-08-27 11:20:01 +0200] information/CheckerComponent: '' started.
[2020-08-27 11:20:01 +0200] information/ConfigItem: Activated all objects.
[2020-08-27 11:20:01 +0200] notice/WorkQueue: Stopped WorkQueue threads for 'DaemonCommand::Run'
[2020-08-27 11:20:01 +0200] notice/ApiListener: Updating object authority for local objects.
[2020-08-27 11:20:01 +0200] notice/Process: Running command 'echo': PID 4453
[2020-08-27 11:20:01 +0200] notice/Process: PID 4453 ('echo') terminated with exit code 0

Hi,

my problem is the host variable which is referenced for this service is empty in the director host configuration but the argument will be used in the command execution so I think the problem is somehow icinga2 thinks there´s a value in the variable. Maybe this problem is because the argument variable will be filled with a referenced host variable. It seems like icinga2 is using the referenced host variable even if it´s empty.

Thanks for your help

Will be fixed in v2.12.1:

Ok thanks do you know when 2.12.1 will be released?

Thanks for your reply!

As soon as possible.