Icinga 2 Script Debugger

by | Nov 12, 2015

We’ve made an effort to make error messages as user-friendly as possible, however there are still cases where additional information is necessary to diagnose a problem. If you’ve ever spent time on figuring out where a configuration error comes from you’re going to love this new feature in Icinga 2.4.
Icinga 2.4 introduces a script debugger which can be used to inspect the state of scripts. For my first example I’m going to use the script debugger to figure out the problem with the following config:

object Host "web1" {
  import "generic-host"
  address = ""
  vars.my_vhosts = {
    "www.icinga.org" = "y"
apply Service "vhost " for (vhost_name => vhost_config in host.vars.my_vhosts) {
  import "generic-service"
  check_command = "http"
  vars.http_timeout = 30
  vars += vhost_config

Let’s have a look at a typical debugger session:

The script debugger’s prompt can be used to print the value of variables and other expressions. As you can see the vhost_config variable should be a dictionary, however in the host definition we have incorrectly set it to a string.
My next example shows how to use breakpoints to inspect variables in a custom attribute function:

object Service "test" {
  import "generic-service"
  host_name = "web1"
  check_command = "dummy"
  check_interval = 15s
  vars.dummy_text = {{
    var text = "Hello from " + host.name
    return text

I hope you’ve enjoyed this quick introduction of the script debugger. More detailed information for this feature can be found in the documentation.

You May Also Like…

Releasing Icinga 2.13.0

Releasing Icinga 2.13.0

Today we're releasing our next major version of Icinga 2. Icinga 2.13 includes many long awaited enhancements and bug...

Subscribe to our Newsletter

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