riemann.pagerduty

Forwards events to Pagerduty

format-event

(format-event event)

Formats an event for PagerDuty

pagerduty

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

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.

You can also pass more http options (like proxy) using the :options key.

(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

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

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