A couple of months ago we introduced the Icinga Output Plugin for Logstash. Today we’re happy to announce v1.1.0. This release includes functionality to dynamically create objects in Icinga 2 and set their state based on incoming events.

With the first release of the Icinga Output Plugin you could run several actions through the Icinga 2 API. Setting the state of a host or service, add comments, set downtimes and many more that we described in an earlier blogpost.

Creating Objects

Logstash is often used for log management and as we know, logs are unpredictable (in many cases). Probably, not everything that is sending logs to your Logstash server is also configured in your monitoring system, but knowing about certain events in your infrastructure would help you to solve issues easier.

This release adds the functionality to create hosts and services in Icinga 2 dynamically, based on the events flowing into Logstash. The defined action then is applied to the newly created objects. As a result you can easily create a host or service on demand, and directly set its state.

Here’s an example configuration:

output {
  icinga {
    host             => ['master1.icinga.com', 'master2.icinga.com']
    user             => 'logstash'
    password         => 'supersecret'
    ssl_verify       => true
    action           => 'process-check-result'
    action_config    => {
      exit_status    => "%{exit_status}"
      plugin_output  => "%{message}"
    }
    icinga_host      => "logstash %{hostname}"
    icinga_service   => "%{program}
    create_object    => true
    object_templates => ['logstash-service']
  }
}