diff --git a/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf b/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf index 84057c211..b9c741c2f 100644 --- a/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf +++ b/.vagrant-puppet/files/etc/icinga2/conf.d/passive.conf @@ -3,7 +3,9 @@ * in the conf.d directory (e.g. one per host). By default all *.conf * files in this directory are included. */ -object Host "nsca-ng" inherits "generic-host" { +object Host "nsca-ng" { + import "generic-host", + display_name = "nsca-ng test", services["PassiveService1"] = { @@ -15,4 +17,4 @@ object Host "nsca-ng" inherits "generic-host" { templates = [ "generic-service" ], check_command = "passive", }, -} \ No newline at end of file +} diff --git a/doc/3.02-commands.md b/doc/3.02-commands.md index 4f3cddc40..f64318bfc 100644 --- a/doc/3.02-commands.md +++ b/doc/3.02-commands.md @@ -59,7 +59,9 @@ then use these macros on the command line. > the service using the check command `disk`. The macros can also > be inherited from a parent template using additive inheritance (`+=`). - object CheckCommand "disk" inherits "plugin-check-command" { + object CheckCommand "disk" { + import "plugin-check-command", + command = [ "$plugindir$/check_disk", "-w", "$wfree$%", @@ -76,7 +78,8 @@ The host `localhost` with the service `disk` checks all disks with modified macros (warning thresholds at `10%`, critical thresholds at `5%` free disk space). - object Host "localhost" inherits "generic-host" { + object Host "localhost" { + import "generic-host", services["disk"] = { templates = [ "generic-service" ], @@ -112,7 +115,9 @@ notification itself (`email` macro attribute provided as `$USERMACRO$`). If you require default macro definitions, you can add a macro dictionary as shown for the `CheckCommand` object. - object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { + object NotificationCommand "mail-service-notification" { + import "plugin-notification-command", + command = [ IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh" ], export_macros = [ @@ -187,7 +192,9 @@ send a check result using the `process_check_result` script forcibly changing the service state back to `OK` (`-r 0`) providing some debug information in the check output (`-o`). - object EventCommand "plugin-event-process-check-result" inherits "plugin-event-command" { + object EventCommand "plugin-event-process-check-result" { + import "plugin-event-command", + command = [ "$plugindir$/process_check_result", "-H", diff --git a/doc/3.03-macros.md b/doc/3.03-macros.md index 6c1b67cdb..5880ef3ab 100644 --- a/doc/3.03-macros.md +++ b/doc/3.03-macros.md @@ -21,7 +21,9 @@ using the available runtime macros for output formatting. Here is an example of a command definition which uses user-defined macros: - object CheckCommand "my-ping" inherits "plugin-check-command" { + object CheckCommand "my-ping" { + import "plugin-check-command", + command = [ "$plugindir$/check_ping", "-4", @@ -126,8 +128,10 @@ Node 2: CheckCommand definition: - object CheckCommand "whatever" inherits "plugin-check-command" { - command = "$plugindir$/check_whatever" + object CheckCommand "whatever" { + import "plugin-check-command", + + command = "$plugindir$/check_whatever" } On Node 1, this will be evaluated into `/usr/lib/icinga/plugins/check_whatever`. @@ -246,18 +250,20 @@ be exported as environment variables prior to executing the command. This is useful for example for hiding sensitive information on the command line output when passing credentials to database checks: - object CheckCommand "mysql-health" inherits "plugin-check-command" { - command = "$plugindir$/check_mysql -H $address$ -d $db$", - /* default macro values */ - macros = { - "MYSQLUSER" = "icinga_check", - "MYSQLPASS" = "1c1ng42r0xx" - }, + object CheckCommand "mysql-health" { + import "plugin-check-command", - export_macros = [ - "MYSQLUSER", - "MYSQLPASS" - ] + command = "$plugindir$/check_mysql -H $address$ -d $db$", + /* default macro values */ + macros = { + "MYSQLUSER" = "icinga_check", + "MYSQLPASS" = "1c1ng42r0xx" + }, + + export_macros = [ + "MYSQLUSER", + "MYSQLPASS" + ] } ### Configuration Macros diff --git a/doc/3.04-notifications.md b/doc/3.04-notifications.md index 86b8d820f..9a91a1a66 100644 --- a/doc/3.04-notifications.md +++ b/doc/3.04-notifications.md @@ -58,7 +58,9 @@ your environment. There are various macros available at runtime execution of the `NotificationCommand`. The example below may or may not fit your needs. - object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { + object NotificationCommand "mail-service-notification" { + import "plugin-notification-command", + command = [ IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh" ], export_macros = [ diff --git a/doc/3.05-using-templates.md b/doc/3.05-using-templates.md index 0cb0a403a..ad77951dc 100644 --- a/doc/3.05-using-templates.md +++ b/doc/3.05-using-templates.md @@ -15,11 +15,15 @@ configuration: check = "ping" } - object Host "my-server1" inherits "linux-server" { + object Host "my-server1" { + import "linux-server", + macros["address"] = "10.0.0.1" } - object Host "my-server2" inherits "linux-server" { + object Host "my-server2" { + import "linux-server", + macros["address"] = "10.0.0.2" } diff --git a/doc/3.06-groups.md b/doc/3.06-groups.md index 4e53e3389..8b3763c24 100644 --- a/doc/3.06-groups.md +++ b/doc/3.06-groups.md @@ -61,13 +61,17 @@ the user groups are associated as attributes in `Notification` objects. groups = [ "windows-mssql-admins" ] } - object User "win-mssql-noc" inherits "generic-windows-mssql-users" { + object User "win-mssql-noc" { + import "generic-windows-mssql-users", + macros = { "email" = "noc@company.com" } } - object User "win-mssql-ops" inherits "generic-windows-mssql-users" { + object User "win-mssql-ops" { + import "generic-windows-mssql-users", + macros = { "email" = "ops@company.com" } diff --git a/doc/3.07-time-periods.md b/doc/3.07-time-periods.md index 2ba56d154..a95a54402 100644 --- a/doc/3.07-time-periods.md +++ b/doc/3.07-time-periods.md @@ -31,7 +31,9 @@ If you don't set any `check_period` or `notification_period` attribute on your configuration objects Icinga 2 assumes `24x7` as time period as shown below. - object TimePeriod "24x7" inherits "legacy-timeperiod" { + object TimePeriod "24x7" { + import "legacy-timeperiod", + display_name = "Icinga 2 24x7 TimePeriod", ranges = { "monday" = "00:00-24:00", @@ -48,7 +50,9 @@ If your operation staff should only be notified during workhours create a new timeperiod named `workhours` defining a work day with 09:00 to 17:00. - object TimePeriod "workhours" inherits "legacy-timeperiod" { + object TimePeriod "workhours" { + import "legacy-timeperiod", + display_name = "Icinga 2 8x5 TimePeriod", ranges = { "monday" = "09:00-17:00", diff --git a/doc/3.15-monitoring-remote-clients.md b/doc/3.15-monitoring-remote-clients.md index 7a95dd76c..ab2ab5a2b 100644 --- a/doc/3.15-monitoring-remote-clients.md +++ b/doc/3.15-monitoring-remote-clients.md @@ -25,7 +25,9 @@ The following example uses the [SNMP ITL](#itl-snmp) `CheckCommand` and only def additional macros (note the `+=` operator) as command parameters for the `oid` (`community` is already set): - object Host "remote-snmp-host" inherits "generic-host" { + object Host "remote-snmp-host" { + import "generic-host", + ... services["uptime"] = { templates = [ "generic-service" ], @@ -44,7 +46,9 @@ additional macros (note the `+=` operator) as command parameters for the `oid` Calling a plugin using the SSH protocol to execute a plugin on the remote server fetching its return code and output. `check_by_ssh` is available in the [Monitoring Plugins package](#setting-up-check-plugins). - object CheckCommand "check_by_ssh_swap" inherits "plugin-check-command" { + object CheckCommand "check_by_ssh_swap" { + import "plugin-check-command", + command = [ "$plugindir$/check_by_ssh", "-l", "remoteuser", "-H", "$address$", @@ -52,7 +56,9 @@ its return code and output. `check_by_ssh` is available in the [Monitoring Plugi ] } - object Host "remote-ssh-host" inherits "generic-host" { + object Host "remote-ssh-host" { + import "generic-host", + ... services["swap"] = { templates = [ "generic-service" ], @@ -82,14 +88,18 @@ remote client. Example: - object CheckCommand "check_nrpe" inherits "plugin-check-command" { + object CheckCommand "check_nrpe" { + import "plugin-check-command", + command = [ "$plugindir$/check_nrpe", "-H", "$address$", "-c", "$remote_nrpe_command$", ], } - object Host "remote-nrpe-host" inherits "generic-host" { + object Host "remote-nrpe-host" { + import "generic-host", + ... services["users"] = { templates = [ "generic-service" ], @@ -122,7 +132,9 @@ the required output and performance counters. Example: - object CheckCommand "check_nscp" inherits "plugin-check-command" { + object CheckCommand "check_nscp" { + import "plugin-check-command", + command = [ "$plugindir$/check_nt", "-H", "$address$", "-p", "$port$", @@ -138,7 +150,9 @@ Example: } } - object Host "remote-windows-host" inherits "generic-host" { + object Host "remote-windows-host" { + import "generic-host", + ... services["users"] = { templates = [ "generic-service" ], diff --git a/doc/4.1-configuration-syntax.md b/doc/4.1-configuration-syntax.md index 5dd7d9c01..516de5abf 100644 --- a/doc/4.1-configuration-syntax.md +++ b/doc/4.1-configuration-syntax.md @@ -317,11 +317,15 @@ Example: macros["color"] = "red" } - template Host "test-host" inherits "default-host" { + template Host "test-host" { + import "default-host", + macros["color"] = "blue" } - object Host "localhost" inherits "test-host" { + object Host "localhost" { + import "test-host", + macros["address"] = "127.0.0.1", macros["address6"] = "::1" } @@ -337,7 +341,7 @@ templates though in general they are. > `color` has the value `"blue"`. Parent objects are resolved in the order they're specified using the -`inherits` keyword. +`import` keyword. ### Disable/Override Objects and Attributes diff --git a/doc/4.3-object-types.md b/doc/4.3-object-types.md index 0af7c07de..5eca34b3e 100644 --- a/doc/4.3-object-types.md +++ b/doc/4.3-object-types.md @@ -327,7 +327,9 @@ when notifications should be sent out. Example: - object TimePeriod "24x7" inherits "legacy-timeperiod" { + object TimePeriod "24x7" { + import "legacy-timeperiod", + display_name = "Icinga 2 24x7 TimePeriod", ranges = { "monday" = "00:00-24:00", @@ -431,7 +433,9 @@ defined here. Example: - object CheckCommand "check_snmp" inherits "plugin-check-command" { + object CheckCommand "check_snmp" { + import "plugin-check-command", + command = "$plugindir$/check_snmp -H $address$ -C $community$ -o $oid$", macros = { @@ -457,7 +461,9 @@ A notification command definition. Example: - object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { + object NotificationCommand "mail-service-notification" { + import "plugin-notification-command", + command = [ IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh" ], export_macros = [ @@ -497,7 +503,9 @@ An event command definition. Example: - object EventCommand "restart-httpd-event" inherits "plugin-event-command" { + object EventCommand "restart-httpd-event" { + import "plugin-event-command", + command = "/opt/bin/restart-httpd.sh", } diff --git a/doc/4.5-best-practice.md b/doc/4.5-best-practice.md index 04f69c6c5..0e495c8f0 100644 --- a/doc/4.5-best-practice.md +++ b/doc/4.5-best-practice.md @@ -81,7 +81,9 @@ does not fit everyone, split it into two. Or rather inherit that template into a new template, and override/disable unwanted values. - template Service "generic-service-disable-notifications" inherits "generic-service" { + template Service "generic-service-disable-notifications" { + import "generic-service", + notifications["mail-icingaadmin"] = null } @@ -201,8 +203,8 @@ downtimes through the template automatism. check = "ping4" } - object Host "localhost" inherits "linux-server" { - + object Host "localhost" { + import "linux-server", } diff --git a/doc/6.01-downtimes.md b/doc/6.01-downtimes.md index 6d2ab0b19..aa98de558 100644 --- a/doc/6.01-downtimes.md +++ b/doc/6.01-downtimes.md @@ -88,7 +88,9 @@ Example: } } - object Host "localhost" inherits "generic-host" { + object Host "localhost" { + import "generic-host", + ... services["load"] = { templates = [ "generic-service" ], @@ -99,4 +101,4 @@ Example: templates = [ "backup-downtime" ] } }, - } \ No newline at end of file + } diff --git a/doc/6.04-cluster.md b/doc/6.04-cluster.md index 4834cd58b..86b18cf71 100644 --- a/doc/6.04-cluster.md +++ b/doc/6.04-cluster.md @@ -210,7 +210,9 @@ If you require specific services to be only executed by one or more checker node within the cluster, you must define `authorities` as additional service object attribute. Required Endpoints must be defined as array. - object Host "dmz-host1" inherits "generic-host" { + object Host "dmz-host1" { + import "generic-host", + services["dmz-oracledb"] = { templates = [ "generic-service" ], authorities = [ "icinga-node-1" ], @@ -232,7 +234,9 @@ one or more configured nodes are not connected. Example: - object Host "icinga2a" inherits "generic-host" { + object Host "icinga2a" { + import "generic-host", + services["cluster"] = { templates = [ "generic-service" ], check_interval = 1m, diff --git a/doc/6.05-domains.md b/doc/6.05-domains.md index 157816c75..24b593d79 100644 --- a/doc/6.05-domains.md +++ b/doc/6.05-domains.md @@ -15,7 +15,9 @@ by any cluster event message, and could be checked by the local authority too pr a different state history. `icinga-node-dmz-2` still receives all cluster message updates from the `icinga-node-dmz-1` endpoint. - object Host "dmz-host1" inherits "generic-host" { + object Host "dmz-host1" { + import "generic-host", + services["dmz-oracledb"] = { templates = [ "generic-service" ], domains = [ "dmz-db" ], @@ -28,4 +30,4 @@ from the `icinga-node-dmz-1` endpoint. icinga-node-dmz-1 = DomainPrivReadOnly, icinga-node-dmz-2 = DomainPrivReadWrite } - } \ No newline at end of file + } diff --git a/doc/8-differences-between-icinga-1x-and-2.md b/doc/8-differences-between-icinga-1x-and-2.md index 82e7f60f4..b79f7fe12 100644 --- a/doc/8-differences-between-icinga-1x-and-2.md +++ b/doc/8-differences-between-icinga-1x-and-2.md @@ -123,15 +123,17 @@ uses the `template` identifier: template Service "ping4-template" { } Icinga 1.x objects inherit from templates using the `use` attribute. -Icinga 2 uses the keyword `inherits` after the object name and requires a -comma-separated list with template names in double quotes. +Icinga 2 uses the keyword `import` with template names in double quotes. define service { service_description testservice use tmpl1,tmpl2,tmpl3 } - object Service "testservice" inherits "tmpl1", "tmpl2", "tmpl3" { + object Service "testservice" { + import "tmpl1", + import "tmpl2", + import "tmpl3" } ## Object attributes @@ -375,7 +377,9 @@ The preferred way of assigning objects to groups is by using a template: } } - object Host "web-dev" inherits "dev-host" { } + object Host "web-dev" { + import "dev-host" + } Host groups in Icinga 2 cannot be used to associate services with all members of that group. The example above shows how to use templates to accomplish diff --git a/etc/icinga2/conf.d/generic-host.conf b/etc/icinga2/conf.d/generic-host.conf index 3094fd2cd..f0df83bdf 100644 --- a/etc/icinga2/conf.d/generic-host.conf +++ b/etc/icinga2/conf.d/generic-host.conf @@ -6,7 +6,9 @@ template Host "generic-host" { } -template Host "linux-server" inherits "generic-host" { +template Host "linux-server" { + import "generic-host", + groups += [ "linux-servers" ], services["ping4"] = { @@ -18,7 +20,9 @@ template Host "linux-server" inherits "generic-host" { check = "ping4" } -template Host "windows-server" inherits "generic-host" { +template Host "windows-server" { + import "generic-host", + groups += [ "windows-servers" ], services["ping4"] = { @@ -30,7 +34,9 @@ template Host "windows-server" inherits "generic-host" { check = "ping4" } -template Host "generic-printer" inherits "generic-host" { +template Host "generic-printer" { + import "generic-host", + services["ping4"] = { templates = [ "generic-service" ], @@ -40,7 +46,9 @@ template Host "generic-printer" inherits "generic-host" { check = "ping4" } -template Host "generic-switch" inherits "generic-host" { +template Host "generic-switch" { + import "generic-host", + services["ping4"] = { templates = [ "generic-service" ], diff --git a/etc/icinga2/conf.d/localhost.conf b/etc/icinga2/conf.d/localhost.conf index 807011582..0d64eeaa2 100644 --- a/etc/icinga2/conf.d/localhost.conf +++ b/etc/icinga2/conf.d/localhost.conf @@ -3,7 +3,9 @@ * in the conf.d directory (e.g. one per host). By default all *.conf * files in this directory are included. */ -object Host "localhost" inherits "linux-server" { +object Host "localhost" { + import "linux-server", + display_name = "localhost", services["icinga"] = { diff --git a/etc/icinga2/conf.d/notifications.conf b/etc/icinga2/conf.d/notifications.conf index 5bd59810c..79d363a2d 100644 --- a/etc/icinga2/conf.d/notifications.conf +++ b/etc/icinga2/conf.d/notifications.conf @@ -22,7 +22,9 @@ template Notification "mail-notification" { notification_period = "24x7" } -object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { +object NotificationCommand "mail-service-notification" { + import "plugin-notification-command", + command = [ IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh" ], export_macros = [ diff --git a/etc/icinga2/conf.d/timeperiods.conf b/etc/icinga2/conf.d/timeperiods.conf index 2f870062e..1b62306d8 100644 --- a/etc/icinga2/conf.d/timeperiods.conf +++ b/etc/icinga2/conf.d/timeperiods.conf @@ -3,7 +3,9 @@ * 'legacy-timeperiod' template from the ITL. */ -object TimePeriod "24x7" inherits "legacy-timeperiod" { +object TimePeriod "24x7" { + import "legacy-timeperiod", + display_name = "Icinga 2 24x7 TimePeriod", ranges = { "monday" = "00:00-24:00", @@ -16,7 +18,9 @@ object TimePeriod "24x7" inherits "legacy-timeperiod" { } } -object TimePeriod "9to5" inherits "legacy-timeperiod" { +object TimePeriod "9to5" { + import "legacy-timeperiod", + display_name = "Icinga 2 9to5 TimePeriod", ranges = { "monday" = "09:00-17:00", @@ -27,7 +31,9 @@ object TimePeriod "9to5" inherits "legacy-timeperiod" { } } -object TimePeriod "never" inherits "legacy-timeperiod" { +object TimePeriod "never" { + import "legacy-timeperiod", + display_name = "Icinga 2 never TimePeriod", ranges = { } diff --git a/etc/icinga2/conf.d/users.conf b/etc/icinga2/conf.d/users.conf index 953a9b903..4e427adcb 100644 --- a/etc/icinga2/conf.d/users.conf +++ b/etc/icinga2/conf.d/users.conf @@ -3,7 +3,9 @@ * group 'icingaadmins'. */ -object User "icingaadmin" inherits "generic-user" { +object User "icingaadmin" { + import "generic-user", + display_name = "Icinga 2 Admin", groups = [ "icingaadmins" ], diff --git a/itl/command-common.conf b/itl/command-common.conf index 71e5e9b89..8c54cca8c 100644 --- a/itl/command-common.conf +++ b/itl/command-common.conf @@ -17,7 +17,9 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -object CheckCommand "ping4" inherits "plugin-check-command" { +object CheckCommand "ping4" { + import "plugin-check-command", + command = [ "$plugindir$/check_ping", "-4", @@ -40,7 +42,9 @@ object CheckCommand "ping4" inherits "plugin-check-command" { } } -object CheckCommand "ping6" inherits "plugin-check-command" { +object CheckCommand "ping6" { + import "plugin-check-command", + command = [ "$plugindir$/check_ping", "-6", @@ -63,7 +67,9 @@ object CheckCommand "ping6" inherits "plugin-check-command" { } } -object CheckCommand "dummy" inherits "plugin-check-command" { +object CheckCommand "dummy" { + import "plugin-check-command", + command = [ "$plugindir$/check_dummy", "$state$", @@ -76,14 +82,18 @@ object CheckCommand "dummy" inherits "plugin-check-command" { } } -object CheckCommand "passive" inherits "dummy" { +object CheckCommand "passive" { + import "dummy", + macros = { state = 3, text = "No Passive Check Result Received." } } -object CheckCommand "tcp" inherits "plugin-check-command" { +object CheckCommand "tcp" { + import "plugin-check-command", + command = [ "$plugindir$/check_tcp", "-H", "$address$", @@ -91,7 +101,9 @@ object CheckCommand "tcp" inherits "plugin-check-command" { ] } -object CheckCommand "udp" inherits "plugin-check-command" { +object CheckCommand "udp" { + import "plugin-check-command", + command = [ "$plugindir$/check_udp", "-H", "$address$", @@ -99,42 +111,54 @@ object CheckCommand "udp" inherits "plugin-check-command" { ] } -object CheckCommand "http_vhost" inherits "plugin-check-command" { +object CheckCommand "http_vhost" { + import "plugin-check-command", + command = [ "$plugindir$/check_http", "-H", "$vhost$" ] } -object CheckCommand "http_ip" inherits "plugin-check-command" { +object CheckCommand "http_ip" { + import "plugin-check-command", + command = [ "$plugindir$/check_http", "-H", "$address$" ] } -object CheckCommand "https_vhost" inherits "plugin-check-command" { +object CheckCommand "https_vhost" { + import "plugin-check-command", + command = [ "$plugindir$/check_http", "-H", "$vhost$", "-S" ] } -object CheckCommand "https_ip" inherits "plugin-check-command" { +object CheckCommand "https_ip" { + import "plugin-check-command", + command = [ "$plugindir$/check_http", "-I", "$address$", "-S" ] } -object CheckCommand "smtp" inherits "plugin-check-command" { +object CheckCommand "smtp" { + import "plugin-check-command", + command = [ "$plugindir$/check_smtp", "-H", "$address$" ] } -object CheckCommand "ssmtp" inherits "plugin-check-command" { +object CheckCommand "ssmtp" { + import "plugin-check-command", + command = [ "$plugindir$/check_ssmtp", "-H", "$address$", @@ -146,21 +170,27 @@ object CheckCommand "ssmtp" inherits "plugin-check-command" { } } -object CheckCommand "ntp_time" inherits "plugin-check-command" { +object CheckCommand "ntp_time" { + import "plugin-check-command", + command = [ "$plugindir$/check_ntp_time", "-H", "$address$" ] } -object CheckCommand "ssh" inherits "plugin-check-command" { +object CheckCommand "ssh" { + import "plugin-check-command", + command = [ "$plugindir$/check_ssh", "$address$" ] } -object CheckCommand "disk" inherits "plugin-check-command" { +object CheckCommand "disk" { + import "plugin-check-command", + command = [ "$plugindir$/check_disk", "-w", "$wfree$%", @@ -173,7 +203,9 @@ object CheckCommand "disk" inherits "plugin-check-command" { } } -object CheckCommand "users" inherits "plugin-check-command" { +object CheckCommand "users"{ + import "plugin-check-command", + command = [ "$plugindir$/check_users", "-w", "$wgreater$", @@ -186,7 +218,9 @@ object CheckCommand "users" inherits "plugin-check-command" { } } -object CheckCommand "processes" inherits "plugin-check-command" { +object CheckCommand "processes"{ + import "plugin-check-command", + command = [ "$plugindir$/check_procs", "-w", "$wgreater$", @@ -199,7 +233,9 @@ object CheckCommand "processes" inherits "plugin-check-command" { } } -object CheckCommand "load" inherits "plugin-check-command" { +object CheckCommand "load"{ + import "plugin-check-command", + command = [ "$plugindir$/check_load", "-w", "$wload1$,$wload5$,$wload15$", @@ -217,7 +253,9 @@ object CheckCommand "load" inherits "plugin-check-command" { } } -object CheckCommand "snmp" inherits "plugin-check-command" { +object CheckCommand "snmp"{ + import "plugin-check-command", + command = [ "$plugindir$/check_snmp", "-H", "$address$", @@ -230,19 +268,27 @@ object CheckCommand "snmp" inherits "plugin-check-command" { } } -object CheckCommand "snmp-uptime" inherits "snmp" { +object CheckCommand "snmp-uptime"{ + import "snmp", + macros += { oid = "1.3.6.1.2.1.1.3.0" } } -object CheckCommand "icinga" inherits "icinga-check-command" { +object CheckCommand "icinga"{ + import "icinga-check-command", + } -object CheckCommand "cluster" inherits "cluster-check-command" { +object CheckCommand "cluster"{ + import "cluster-check-command", + } -object CheckCommand "snmp-extend" inherits "plugin-check-command" { +object CheckCommand "snmp-extend"{ + import "plugin-check-command", + command = [ IcingaSysconfDir + "/icinga2/scripts/snmp-extend.sh", "$HOSTADDRESS$", diff --git a/lib/config/aexpression.cpp b/lib/config/aexpression.cpp index c1f1b3a66..09b055ec8 100644 --- a/lib/config/aexpression.cpp +++ b/lib/config/aexpression.cpp @@ -19,6 +19,7 @@ #include "config/aexpression.h" #include "config/configerror.h" +#include "config/configitem.h" #include "base/array.h" #include "base/serializer.h" #include "base/context.h" @@ -459,3 +460,18 @@ Value AExpression::OpIndexer(const AExpression *expr, const Dictionary::Ptr& loc return dict->Get(expr->m_Operand2); } + +Value AExpression::OpImport(const AExpression *expr, const Dictionary::Ptr& locals) +{ + Value type = expr->EvaluateOperand1(locals); + Value name = expr->EvaluateOperand2(locals); + + ConfigItem::Ptr item = ConfigItem::GetObject(type, name); + + if (!item) + BOOST_THROW_EXCEPTION(ConfigError("Import references unknown template: '" + name + "'")); + + item->GetExpressionList()->Evaluate(locals); + + return Empty; +} diff --git a/lib/config/aexpression.h b/lib/config/aexpression.h index 6a0236205..05bf14500 100644 --- a/lib/config/aexpression.h +++ b/lib/config/aexpression.h @@ -79,6 +79,7 @@ public: static Value OpSetMultiply(const AExpression *expr, const Dictionary::Ptr& locals); static Value OpSetDivide(const AExpression *expr, const Dictionary::Ptr& locals); static Value OpIndexer(const AExpression *expr, const Dictionary::Ptr& locals); + static Value OpImport(const AExpression *expr, const Dictionary::Ptr& locals); private: OpCallback m_Operator; diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 06e116113..4d28b0974 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -224,6 +224,7 @@ const return T_CONST; apply return T_APPLY; to return T_TO; where return T_WHERE; +import return T_IMPORT; \<\< { yylval->op = &AExpression::OpShiftLeft; return T_SHIFT_LEFT; } \>\> { yylval->op = &AExpression::OpShiftRight; return T_SHIFT_RIGHT; } \<= { yylval->op = &AExpression::OpLessThanOrEqual; return T_LESS_THAN_OR_EQUAL; } diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 95cea330a..69e716e63 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -144,6 +144,7 @@ using namespace icinga; %token T_APPLY "apply (T_APPLY)" %token T_TO "to (T_TO)" %token T_WHERE "where (T_WHERE)" +%token T_IMPORT "import (T_IMPORT)" %type identifier %type rterm_items %type rterm_items_inner @@ -154,8 +155,6 @@ using namespace icinga; %type rbinary_op %type type %type partial_specifier -%type object_inherits_list -%type object_inherits_specifier %type rterm %type rterm_scope %type lterm @@ -411,9 +410,9 @@ object: { m_Abstract = false; } - object_declaration identifier rterm object_inherits_specifier rterm_scope + object_declaration identifier rterm rterm_scope { - DebugInfo di = DebugInfoRange(@2, @6); + DebugInfo di = DebugInfoRange(@2, @5); ConfigItemBuilder::Ptr item = make_shared(di); AExpression::Ptr aexpr = static_cast(*$4); @@ -444,16 +443,8 @@ object: item->SetName(name); - if ($5) { - BOOST_FOREACH(const String& parent, *$5) { - item->AddParent(parent); - } - - delete $5; - } - - AExpression::Ptr exprl = static_cast(*$6); - delete $6; + AExpression::Ptr exprl = static_cast(*$5); + delete $5; exprl->MakeInline(); item->AddExpression(exprl); @@ -473,38 +464,6 @@ object_declaration: T_OBJECT m_Abstract = true; } -object_inherits_list: - { - $$ = NULL; - } - | T_STRING - { - $$ = new std::vector(); - $$->push_back($1); - free($1); - } - | object_inherits_list ',' T_STRING - { - if ($1) - $$ = $1; - else - $$ = new std::vector(); - - $$->push_back($3); - free($3); - } - ; - -object_inherits_specifier: - { - $$ = NULL; - } - | T_INHERITS object_inherits_list - { - $$ = $2; - } - ; - lbinary_op: T_SET | T_SET_PLUS | T_SET_MINUS @@ -661,6 +620,13 @@ rterm: T_STRING $$ = new Value(make_shared(&AExpression::OpFunctionCall, $1, make_shared(&AExpression::OpLiteral, arguments, @3), DebugInfoRange(@1, @4))); free($1); } + | T_IMPORT rterm + { + AExpression::Ptr avar = make_shared(&AExpression::OpVariable, "__type", DebugInfoRange(@1, @2)); + AExpression::Ptr aexpr = static_cast(*$2); + delete $2; + $$ = new Value(make_shared(&AExpression::OpImport, avar, aexpr, DebugInfoRange(@1, @2))); + } | T_IDENTIFIER { $$ = new Value(make_shared(&AExpression::OpVariable, $1, @1)); diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index 8668dbf3c..dbdfaee99 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -44,15 +44,13 @@ ConfigItem::ItemMap ConfigItem::m_Items; * @param unit The unit of the item. * @param abstract Whether the item is a template. * @param exprl Expression list for the item. - * @param parents Parent objects for the item. * @param debuginfo Debug information. */ ConfigItem::ConfigItem(const String& type, const String& name, bool abstract, const AExpression::Ptr& exprl, - const std::vector& parents, const DebugInfo& debuginfo, - const Dictionary::Ptr& scope) + const DebugInfo& debuginfo, const Dictionary::Ptr& scope) : m_Type(type), m_Name(name), m_Abstract(abstract), m_Validated(false), - m_ExpressionList(exprl), m_ParentNames(parents), m_DebugInfo(debuginfo), + m_ExpressionList(exprl), m_DebugInfo(debuginfo), m_Scope(scope) { } @@ -112,42 +110,6 @@ AExpression::Ptr ConfigItem::GetExpressionList(void) const return m_ExpressionList; } -AExpression::Ptr ConfigItem::GetLinkedExpressionList(void) -{ - ASSERT(OwnsLock()); - - if (m_LinkedExpressionList) - return m_LinkedExpressionList; - - Array::Ptr subexprs = make_shared(); - - BOOST_FOREACH(const String& name, m_ParentNames) { - ConfigItem::Ptr parent = ConfigItem::GetObject(m_Type, name); - - if (!parent) { - std::ostringstream message; - message << "Parent object '" << name << "' does not" - " exist (" << m_DebugInfo << ")"; - ConfigCompilerContext::GetInstance()->AddMessage(true, message.str(), m_DebugInfo); - } else { - AExpression::Ptr pexprl; - - { - ObjectLock olock(parent); - pexprl = parent->GetLinkedExpressionList(); - } - - subexprs->Add(pexprl); - } - } - - subexprs->Add(m_ExpressionList); - - m_LinkedExpressionList = make_shared(&AExpression::OpDict, subexprs, true, m_DebugInfo); - - return m_LinkedExpressionList; -} - Dictionary::Ptr ConfigItem::GetProperties(void) { ASSERT(OwnsLock()); @@ -155,7 +117,7 @@ Dictionary::Ptr ConfigItem::GetProperties(void) if (!m_Properties) { m_Properties = make_shared(); m_Properties->Set("__parent", m_Scope); - GetLinkedExpressionList()->Evaluate(m_Properties); + GetExpressionList()->Evaluate(m_Properties); m_Properties->Remove("__parent"); VERIFY(m_Properties->Get("__type") == GetType() && m_Properties->Get("__name") == GetName()); diff --git a/lib/config/configitem.h b/lib/config/configitem.h index 7af2918dc..09f1c33d8 100644 --- a/lib/config/configitem.h +++ b/lib/config/configitem.h @@ -45,8 +45,8 @@ public: DECLARE_PTR_TYPEDEFS(ConfigItem); ConfigItem(const String& type, const String& name, bool abstract, - const AExpression::Ptr& exprl, const std::vector& parents, - const DebugInfo& debuginfo, const Dictionary::Ptr& scope); + const AExpression::Ptr& exprl, const DebugInfo& debuginfo, + const Dictionary::Ptr& scope); String GetType(void) const; String GetName(void) const; @@ -54,7 +54,7 @@ public: std::vector GetParents(void) const; - AExpression::Ptr GetLinkedExpressionList(void); + AExpression::Ptr GetExpressionList(void) const; Dictionary::Ptr GetProperties(void); DynamicObject::Ptr Commit(void); @@ -74,8 +74,6 @@ public: static void DiscardItems(void); private: - AExpression::Ptr GetExpressionList(void) const; - String m_Type; /**< The object type. */ String m_Name; /**< The name. */ bool m_Abstract; /**< Whether this is a template. */ @@ -88,8 +86,6 @@ private: DebugInfo m_DebugInfo; /**< Debug information. */ Dictionary::Ptr m_Scope; /**< variable scope. */ - AExpression::Ptr m_LinkedExpressionList; - DynamicObject::Ptr m_Object; static boost::mutex m_Mutex; diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp index dbae3768e..18ea4e939 100644 --- a/lib/config/configitembuilder.cpp +++ b/lib/config/configitembuilder.cpp @@ -60,11 +60,6 @@ void ConfigItemBuilder::SetScope(const Dictionary::Ptr& scope) m_Scope = scope; } -void ConfigItemBuilder::AddParent(const String& parent) -{ - m_Parents.push_back(parent); -} - void ConfigItemBuilder::AddExpression(const AExpression::Ptr& expr) { m_Expressions->Add(expr); @@ -90,18 +85,13 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void) BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str())); } - BOOST_FOREACH(const String& parent, m_Parents) { - if (parent == m_Name) - BOOST_THROW_EXCEPTION(std::invalid_argument("Configuration item '" + m_Name + "' of type '" + m_Type + "' must not inherit from itself.")); - } - Array::Ptr exprs = make_shared(); exprs->Add(make_shared(&AExpression::OpSet, "__type", make_shared(&AExpression::OpLiteral, m_Type, m_DebugInfo), m_DebugInfo)); - exprs->Add(make_shared(&AExpression::OpSet, "__name", make_shared(&AExpression::OpLiteral, m_Name, m_DebugInfo), m_DebugInfo)); exprs->Add(make_shared(&AExpression::OpDict, m_Expressions, true, m_DebugInfo)); + exprs->Add(make_shared(&AExpression::OpSet, "__name", make_shared(&AExpression::OpLiteral, m_Name, m_DebugInfo), m_DebugInfo)); AExpression::Ptr exprl = make_shared(&AExpression::OpDict, exprs, true, m_DebugInfo); return make_shared(m_Type, m_Name, m_Abstract, exprl, - m_Parents, m_DebugInfo, m_Scope); + m_DebugInfo, m_Scope); } diff --git a/lib/config/configitembuilder.h b/lib/config/configitembuilder.h index 74fa75df6..14537f1d8 100644 --- a/lib/config/configitembuilder.h +++ b/lib/config/configitembuilder.h @@ -47,8 +47,6 @@ public: void SetAbstract(bool abstract); void SetScope(const Dictionary::Ptr& scope); - void AddParent(const String& parent); - void AddExpression(const AExpression::Ptr& expr); ConfigItem::Ptr Compile(void); @@ -57,8 +55,6 @@ private: String m_Type; /**< The object type. */ String m_Name; /**< The name. */ bool m_Abstract; /**< Whether the item is abstract. */ - std::vector m_Parents; /**< The names of parent configuration - items. */ Array::Ptr m_Expressions; /**< Expressions for this item. */ DebugInfo m_DebugInfo; /**< Debug information. */ Dictionary::Ptr m_Scope; /**< variable scope. */ diff --git a/lib/icinga/host-apply.cpp b/lib/icinga/host-apply.cpp index 010987ba4..fd48006cb 100644 --- a/lib/icinga/host-apply.cpp +++ b/lib/icinga/host-apply.cpp @@ -49,8 +49,10 @@ void Host::EvaluateApplyRules(const std::vector& rules) locals->Set("hostgroups", groups); BOOST_FOREACH(const ApplyRule& rule, rules) { + DebugInfo di = rule.GetDebugInfo(); + std::ostringstream msgbuf; - msgbuf << "Evaluating 'apply' rule (" << rule.GetDebugInfo() << ")"; + msgbuf << "Evaluating 'apply' rule (" << di << ")"; CONTEXT(msgbuf.str()); Value result = rule.GetExpression()->Evaluate(locals); @@ -60,27 +62,30 @@ void Host::EvaluateApplyRules(const std::vector& rules) continue; } catch (...) { std::ostringstream msgbuf; - msgbuf << "Apply rule (" << rule.GetDebugInfo() << ") returned invalid data type, expected bool: " + JsonSerialize(result); + msgbuf << "Apply rule (" << di << ") returned invalid data type, expected bool: " + JsonSerialize(result); Log(LogCritical, "icinga", msgbuf.str()); continue; } std::ostringstream msgbuf2; - msgbuf2 << "Applying service template '" << rule.GetTemplate() << "' to host '" << host->GetName() << "' for rule " << rule.GetDebugInfo(); + msgbuf2 << "Applying service template '" << rule.GetTemplate() << "' to host '" << host->GetName() << "' for rule " << di; Log(LogDebug, "icinga", msgbuf2.str()); std::ostringstream namebuf; namebuf << host->GetName() << "!apply!" << rule.GetTemplate(); String name = namebuf.str(); - ConfigItemBuilder::Ptr builder = make_shared(rule.GetDebugInfo()); + ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Service"); builder->SetName(name); builder->SetScope(rule.GetScope()); - builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, host->GetName(), rule.GetDebugInfo()), rule.GetDebugInfo())); - builder->AddParent(rule.GetTemplate()); + AExpression::Ptr atype = make_shared(&AExpression::OpLiteral, "Service", di); + AExpression::Ptr atmpl = make_shared(&AExpression::OpLiteral, rule.GetTemplate(), di); + builder->AddExpression(make_shared(&AExpression::OpImport, atype, atmpl, di)); + + builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, host->GetName(), di), di)); ConfigItem::Ptr serviceItem = builder->Compile(); serviceItem->Register(); diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 386605473..2306c762a 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -118,7 +118,7 @@ void Host::UpdateSlaveServices(void) { ObjectLock ilock(item); - exprl = item->GetLinkedExpressionList(); + exprl = item->GetExpressionList(); } DebugInfo di; @@ -130,12 +130,6 @@ void Host::UpdateSlaveServices(void) ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Service"); builder->SetName(name); - builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetName(), di), di)); - builder->AddExpression(make_shared(&AExpression::OpSet, "display_name", make_shared(&AExpression::OpLiteral, kv.first, di), di)); - builder->AddExpression(make_shared(&AExpression::OpSet, "short_name", make_shared(&AExpression::OpLiteral, kv.first, di), di)); - - if (!kv.second.IsObjectType()) - BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary.")); Dictionary::Ptr service = kv.second; @@ -145,10 +139,19 @@ void Host::UpdateSlaveServices(void) ObjectLock olock(templates); BOOST_FOREACH(const Value& tmpl, templates) { - builder->AddParent(tmpl); + AExpression::Ptr atype = make_shared(&AExpression::OpLiteral, "Service", di); + AExpression::Ptr atmpl = make_shared(&AExpression::OpLiteral, tmpl, di); + builder->AddExpression(make_shared(&AExpression::OpImport, atype, atmpl, di)); } } + builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetName(), di), di)); + builder->AddExpression(make_shared(&AExpression::OpSet, "display_name", make_shared(&AExpression::OpLiteral, kv.first, di), di)); + builder->AddExpression(make_shared(&AExpression::OpSet, "short_name", make_shared(&AExpression::OpLiteral, kv.first, di), di)); + + if (!kv.second.IsObjectType()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Service description must be either a string or a dictionary.")); + /* Clone attributes from the service expression list. */ Array::Ptr svc_exprl = make_shared(); exprl->ExtractPath(path, svc_exprl); diff --git a/lib/icinga/service-dependency.cpp b/lib/icinga/service-dependency.cpp index 36b455bee..ea41d83c6 100644 --- a/lib/icinga/service-dependency.cpp +++ b/lib/icinga/service-dependency.cpp @@ -198,7 +198,7 @@ void Service::UpdateSlaveDependencies(void) { ObjectLock ilock(item); - exprl = item->GetLinkedExpressionList(); + exprl = item->GetExpressionList(); } DebugInfo di; @@ -210,8 +210,7 @@ void Service::UpdateSlaveDependencies(void) ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Dependency"); builder->SetName(name); - builder->AddExpression(make_shared(&AExpression::OpSet, "child_host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); - builder->AddExpression(make_shared(&AExpression::OpSet, "child_service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); + Dictionary::Ptr dependency = kv.second; @@ -221,10 +220,15 @@ void Service::UpdateSlaveDependencies(void) ObjectLock tlock(templates); BOOST_FOREACH(const Value& tmpl, templates) { - builder->AddParent(tmpl); + AExpression::Ptr atype = make_shared(&AExpression::OpLiteral, "Dependency", di); + AExpression::Ptr atmpl = make_shared(&AExpression::OpLiteral, tmpl, di); + builder->AddExpression(make_shared(&AExpression::OpImport, atype, atmpl, di)); } } + builder->AddExpression(make_shared(&AExpression::OpSet, "child_host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); + builder->AddExpression(make_shared(&AExpression::OpSet, "child_service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); + /* Clone attributes from the scheduled downtime expression list. */ Array::Ptr sd_exprl = make_shared(); exprl->ExtractPath(path, sd_exprl); diff --git a/lib/icinga/service-downtime.cpp b/lib/icinga/service-downtime.cpp index d914284a4..aa11fd797 100644 --- a/lib/icinga/service-downtime.cpp +++ b/lib/icinga/service-downtime.cpp @@ -347,7 +347,7 @@ void Service::UpdateSlaveScheduledDowntimes(void) { ObjectLock ilock(item); - exprl = item->GetLinkedExpressionList(); + exprl = item->GetExpressionList(); } DebugInfo di; @@ -359,8 +359,6 @@ void Service::UpdateSlaveScheduledDowntimes(void) ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("ScheduledDowntime"); builder->SetName(name); - builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); - builder->AddExpression(make_shared(&AExpression::OpSet, "service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); Dictionary::Ptr scheduledDowntime = kv.second; @@ -370,10 +368,15 @@ void Service::UpdateSlaveScheduledDowntimes(void) ObjectLock tlock(templates); BOOST_FOREACH(const Value& tmpl, templates) { - builder->AddParent(tmpl); + AExpression::Ptr atype = make_shared(&AExpression::OpLiteral, "ScheduledDowntime", di); + AExpression::Ptr atmpl = make_shared(&AExpression::OpLiteral, tmpl, di); + builder->AddExpression(make_shared(&AExpression::OpImport, atype, atmpl, di)); } } + builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); + builder->AddExpression(make_shared(&AExpression::OpSet, "service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); + /* Clone attributes from the scheduled downtime expression list. */ Array::Ptr sd_exprl = make_shared(); exprl->ExtractPath(path, sd_exprl); diff --git a/lib/icinga/service-notification.cpp b/lib/icinga/service-notification.cpp index 5fb711aa4..6a4942ac9 100644 --- a/lib/icinga/service-notification.cpp +++ b/lib/icinga/service-notification.cpp @@ -126,7 +126,7 @@ void Service::UpdateSlaveNotifications(void) { ObjectLock ilock(item); - exprl = item->GetLinkedExpressionList(); + exprl = item->GetExpressionList(); } DebugInfo di; @@ -138,8 +138,6 @@ void Service::UpdateSlaveNotifications(void) ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Notification"); builder->SetName(name); - builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); - builder->AddExpression(make_shared(&AExpression::OpSet, "service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); Dictionary::Ptr notification = kv.second; @@ -149,10 +147,15 @@ void Service::UpdateSlaveNotifications(void) ObjectLock tlock(templates); BOOST_FOREACH(const Value& tmpl, templates) { - builder->AddParent(tmpl); + AExpression::Ptr atype = make_shared(&AExpression::OpLiteral, "Notification", di); + AExpression::Ptr atmpl = make_shared(&AExpression::OpLiteral, tmpl, di); + builder->AddExpression(make_shared(&AExpression::OpImport, atype, atmpl, di)); } } + builder->AddExpression(make_shared(&AExpression::OpSet, "host", make_shared(&AExpression::OpLiteral, GetHost()->GetName(), di), di)); + builder->AddExpression(make_shared(&AExpression::OpSet, "service", make_shared(&AExpression::OpLiteral, GetShortName(), di), di)); + /* Clone attributes from the notification expression list. */ Array::Ptr nfc_exprl = make_shared(); exprl->ExtractPath(path, nfc_exprl); diff --git a/test/jenkins/files/configs/eventhandler.conf b/test/jenkins/files/configs/eventhandler.conf index 308f833b5..54e52523a 100644 --- a/test/jenkins/files/configs/eventhandler.conf +++ b/test/jenkins/files/configs/eventhandler.conf @@ -1,4 +1,6 @@ -object EventCommand "test_event" inherits "plugin-event-command" { +object EventCommand "test_event" { + import "plugin-event-command", + command = {{{echo "\ $$HOSTNAME$HOSTNAME$\ |HOSTNAME=$HOSTNAME$\ diff --git a/test/jenkins/files/configs/notifications.conf b/test/jenkins/files/configs/notifications.conf index 1c6a0ae5a..b30d57f4d 100644 --- a/test/jenkins/files/configs/notifications.conf +++ b/test/jenkins/files/configs/notifications.conf @@ -24,7 +24,9 @@ template Notification "mail-notification" { /** * 1:1 copy of the default command */ -object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" { +object NotificationCommand "mail-service-notification" { + import "plugin-notification-command", + command = [ (IcingaSysconfDir + "/icinga2/scripts/mail-notification.sh") ], export_macros = [