Icinga2 Director - Event Handler

Hello Everybody,

i have a rather stupid question.
When i define an Event Plugin Command how can i link it to an Service check?

We check on a Website via HTTPS und search for an String rather simple:

object Service "Check - www.fohhn.com/en/" {
    host_name = "www.host.com"
    import "CheckWeb"

    vars.http_string = "The perfect string on website"
    vars.http_uri = "/subsite/"
    vars.http_vhost = "www.host.com"
}

from this template:

template Service "CheckWeb" {
    check_command = "http"
    max_check_attempts = "3"
    check_interval = 2m
    retry_interval = 30s
    enable_notifications = true
    enable_active_checks = true
    enable_passive_checks = true
    enable_event_handler = true
    enable_flapping = false
    enable_perfdata = true
    volatile = false
    command_endpoint = null
    vars.http_ssl = true
    vars.http_uri = "/"
}

where it states
enable_event_handler = true

So when i define an event plugin command with a simple restart bash script i cannot select it?

Or do i have it to create the manual way?

Is this a bug or am i just using it the wrong way? Anything helps.

Best and thanks,
Dave

Thanks a lot!

Hello,

just add

event_command = EVENT_COMMAND_NAME

to your service. As described in the docs.

Regards,
Carsten

Regards,
Carsten

Hi Carsten,

how can I edit an service created by the icinga2 director?

When I edit it directly in the file itself it will not show up and the director will override the service when I deploy changes.

Hi,

If you created the service with the director, you should handle this also there. Because every deployment it will be overwritten, unless you save the file extra.

With the director it’s much more easier:

  1. create a an event plugin command. e.g:
  2. after that you choose the two marked option in the screenshot:
  3. finish
2 Likes