Icinga 2 0.0.9 – Introducing Configuration Apply Rules

by | Mar 31, 2014

This release introduces a cool new feature for your Icinga 2 configuration: You can now use a rule based apply logic to assign services to hosts (and notifications, downtimes, dependencies to services, that is). The conditions for assigning (and ignoring for exclusion) are capable of accessing all object attributes, not only host or host group names. Apply rules can also import existing templates.
A simple example assigning the service “ping6” to all hosts which have the “address6” macro defined and import the “ripe-host” template looks like this:

template Host "ripe-host" {
  check = "ping6"
}
object Host "atlas.ripe.net" {
  import "ripe-host",
  macros.address6 = "2001:67c:2e8:22::c100:69e"
}
object Host "labs.ripe.net" {
  import "ripe-host",
  macros.address6 = "2001:67c:2e8:22::c100:699"
}
apply Service "ping6" {
  import "generic-service",
  check_command = "ping6",
  assign where "ripe-host" in host.templates,
  ignore where !host.macros.address6
}

The updated localhost.conf also reflects that new configuration method.
We’ve discussed quite a lot during the past weeks about the configuration format, and especially the collected feedback. While using templates and inline object definitions will work for generic configurations, it will get tricky with the obvious requirement of “assign a service to a group of hosts”. Every admin asks about it, and the new apply logic simply allows you to do it. Not only with groups, but with every other object attribute (define your own macro “sla” and match that for example).
Since this release is also about changes while improving features: The apply logic replaces the inline object definitions. They’re gone, so make sure to update your object configuration right away. There are some more to come for the 0.0.10 release prior a final release.
Further changes introduce the “import” keyword instead of the object “inherits” keyword. The global $plugindir$ macro has been replaced by the constant named “PluginDir” defined in constants.conf (newly included in icinga2.conf, required by the Icinga Template Library (ITL)).
If you’re running into configuration errors – their output has been significantly improved by providing detailed information on which string is incorrect. Unknown attributes and duplicate object definitions now result in a configuration error. Last but not least: The new host check attribute requires Classic UI 1.11.1 if you’re using this user interface for Icinga 2.

Download Icinga 2 0.0.9 now – package builds are available.
Thanks for all your feedback & bug reports – they are paving the way towards a final release! 🙂

CHANGE LOG

  • new apply rules for assigning objects based on attribute conditions
  • inline object definitions removed in favor of apply rules
  • import keyword instead of inherits keyword for all objects
  • new constants.conf providing PluginDir constant instead of $plugindir$ macro
  • unknown attributes and duplicate objects generate a configuration error
  • improved configuration error output
  • create endpoint tables for legacy interfaces (status data, DB IDO, Livestatus)
  • export host check attribute in legacy interfaces (status data, DB IDO, Livestatus)
  • add documentation about cluster scenarios
  • Livestatus: add check_source attribute to services table
  • Compat: Fix host service order for Classic UI
  • Remove comments when clearing acknowledgements
  • Recovery Notifications require StateFilterOK

CHANGES

  • removed deprecated var/set identifier, use const instead
  • constants.conf needs to be included in icinga2.conf before ITL inclusion
  • import instead of inherits (examples in localhost.conf)
  • apply rules instead of inline definitions for Service, Dependency, Notification, ScheduledDowntime objects (examples in localhost.conf).
  • unknown attributes and duplicate objects generate a configuration error
  • DB IDO: schema update for 0.0.9 (MySQL, PostgreSQL)

You May Also Like…

Releasing Icinga Web v2.12.2

Releasing Icinga Web v2.12.2

Today we’re announcing the general availability of Icinga Web v2.12.2. You can find all issues related to this release...

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.