Forwards events to Pagerduty


(format-event event)

Formats an event for PagerDuty


(pagerduty {:keys [service-key formatter], :or {formatter format-event}})

Creates a PagerDuty adapter. Takes your PD service key, and returns a map of functions which trigger, acknowledge, and resolve events. By default, event service will be used as the incident key. The PD description will be the service, state, and metric. The full event will be attached as the details.

You can override this by specifying a formatter. The formatter must be a function that accepts an event and emits a hash.

(defn pd-format-event [event] {:incident_key ‘Incident key’, :description ‘Incident Description’, :details ‘Incident details’})

The :formatter is an optional argument.

(let [pd (pagerduty { :service-key “my-service-key” :formatter pd-format-event})] (changed-state (where (state “ok”) (:resolve pd)) (where (state “critical”) (:trigger pd))))


(send-event service-key event-type formatter event)

Sends an event to PD. event-type is one of :trigger, :acknowledge, :resolve