icinga2

icinga event command attribute missing "execute" error with v2.3.9


I'm using icinga v2.3.9 on centos7

while configuring an EventCommand object,

[2018-12-14 12:34:03 +0000] information/ConfigItem: Committing config items
[2018-12-14 12:34:03 +0000] critical/config: Error: Required attribute is missing: Object 'restart_service' (Type: 'EventCommand') at /etc/icinga2/zones.d/global-templates/eventcommands.conf:2 -> Attribute 'execute'
[2018-12-14 12:34:03 +0000] critical/config: 1 error

[root@server icinga2]# cat zones.d/global-templates/eventcommands.conf

object EventCommand "restart_service" {
  command = [ PluginDir + "/restart_service" ]

  arguments = {
    "-s" = "$service.state$"
    "-t" = "$service.state_type$"
    "-a" = "$service.check_attempt$"
    "-S" = "$restart_service$"
    "-H" = "$host.name$"
  }

  vars.restart_service = "$procs_command$"
}
}

Am I missing something, this config works in v2.10.2-1


Solution

  • Ok, I found the silly mistake.

    import "plugin-event-command" was missing.

    I added it and it worked.

    But somehow it was not needed explicitly in v2.10