riemann.pagerduty

Forwards events to Pagerduty

format-event-v1

(format-event-v1 event)

Formats an event for PagerDuty v1 API

format-event-v2

(format-event-v2 event)

Formats an event for PagerDuty v2 API

pagerduty

(pagerduty config)

Creates a PagerDuty adapter. By default, use the pagerduty v1 API. You can use the v2 API by setting the :version option to :v2.

Returns a map of functions which trigger, acknowledge, and resolve events.

General options:

  • :service-key Pagerduty service key (also called integration key or routing key)
  • :formatter Formatter for the pagerduty event. You can override the default formatter. The formatter must be a function that accepts an event and emits a hash. (optional)
  • :options Extra HTTP options. (optional)
  • :version set to :v2 to use Pagerduty v2 API. (optional)

v1 API:

By default, event host and service will be used as the incident key. The PD description will be the host, service, state, and metric. The full event will be attached as the details.

v2 API:

By default, event host will be used as the source. The PD summary will be the host, service, state, and metric. The severity is the state. The full event will be attached as the details.

Each event can also contains a :dedup-key key to handle alert de-duplication.

Example, using the v1 API with a custom formatter:

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

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

request-body-v1

(request-body-v1 service-key event-type formatter event)

Generate PD v1 API request body. event-type is one of :trigger, :acknowledge, :resolve

request-body-v2

(request-body-v2 service-key event-action formatter event)

Generate PD v2 API request body. event-action is one of :trigger, :acknowledge, :resolve

send-event

(send-event event-type config event)

Send an event to Pagerduty.

timestamp-formatter