Director pagerduty integration

Hi!

Currently, I am trying to set up pagerduty. I followed the official integration guide but this is not considering the director module. So I tried to the best of my knowledge to adapt it to the director by doing the following:

  1. created the service within pagerduty and got the integration key
  2. on my icinga machine, I installed the pagerduty agent as described in the guide
  3. Downloaded the pagerduty-icinga2.conf and moved it to /etc/icinga2/conf.d
  4. pasted my pagerduty integration key in the .conf file
  5. restarted icinga service, ran validation - all good
  6. in the director, I created the following data fields:

  1. I assigned these vars to one of my host-templates for testing:

  1. created the user “pagerduty.director” and copied the pagerduty integration key into the “pager” field
  2. I send a custom notification but this never pops up in pagerduty as an alert.

Maybe, someone here has an idea or can point me in the correct direction, it would be much appreciated. thanks in advance

EDIT:
the pagerduty-icinga2.conf file, contains the following lines:

object User “pagerduty” {
pager = “MY-INTEGRATION-KEY”
groups = [ “icingaadmins” ]
display_name = “PagerDuty Notification User”
states = [ OK, Warning, Critical, Unknown, Up, Down ]
types = [ Problem, Acknowledgement, Recovery ]

I am pretty sure, that this cannot work as it is trying to use a user named “pagerduty” that does not even exist.

I was able to solve it myself now:

I ended up using the pagerduty agent.
After its installation, I created a custom command in director which utilizes

/usr/bin/pd-send

The one tricky thing I encoutered was to correctly use the pagerduty event_type. pagerduty API knows three types: trigger, acknowledge and resolve. So in order to make this work in the director, I had to write some logic and use the “icinga DSL” value type when handing over the arguments to the command execution:

Since it is not possible to use the macro host.state directly, I saved it in a variable “status”.

Now everything works perfectly fine.