Safe Haskell | None |
---|---|
Language | Haskell2010 |
The PagerDuty event integration API is how you would add PagerDuty's advanced alerting functionality to any system that can make an HTTP API call. You can now add phone, SMS and email alerting to your monitoring tools, ticketing systems and custom software.
The API was designed to allow you to easily integrate a monitoring system with a Service in PagerDuty. Monitoring systems generally send out events when problems are detected and when these problems have been resolved (fixed). Some more advanced systems also understand the concept of acknowledgements: problems can be acknowledged by an engineer to signal he or she is working on fixing the issue.
Since monitoring systems emit events, the API is based around accepting events. Incoming events (sent via the API) are routed to a PagerDuty service and processed. They may result in a new incident being created, or an existing incident being acknowledged or resolved.
The same event-based API can also be used to integrate a PagerDuty service with ticketing systems and various other software tools.
See: http://developer.pagerduty.com/documentation/integration/events
- submit :: MonadIO m => Manager -> Event -> m (Either Error Response)
- submitWith :: MonadIO m => Manager -> Logger -> Event -> m (Either Error Response)
- data Trigger
- trigger :: ServiceKey -> IncidentKey -> Text -> Event
- client :: Lens' Trigger (Maybe Text)
- clientUrl :: Lens' Trigger (Maybe Text)
- type Acknowledge = Generic
- acknowledge :: ServiceKey -> IncidentKey -> Event
- type Resolve = Generic
- resolve :: ServiceKey -> IncidentKey -> Event
- class HasServiceKey s a | s -> a where
- serviceKey :: Lens' s a
- class HasIncidentKey s a | s -> a where
- incidentKey :: Lens' s a
- class HasDescription s a | s -> a where
- description :: Lens' s a
- class HasDetails s a | s -> a where
- details :: Lens' s a
- data Event
- = Trigger Trigger
- | Acknowledge Generic
- | Resolve Generic
- _Trigger :: Prism' Event Trigger
- _Acknowledge :: Prism' Event Generic
- _Resolve :: Prism' Event Generic
- data Response
- rsStatus :: Lens' Response Text
- rsMessage :: Lens' Response Text
- rsIncidentKey :: Lens' Response IncidentKey
Sending events
submit :: MonadIO m => Manager -> Event -> m (Either Error Response) Source
Send an event to the integration API.
submitWith :: MonadIO m => Manager -> Logger -> Event -> m (Either Error Response) Source
See: submit
Trigger
:: ServiceKey | |
-> IncidentKey | |
-> Text | |
-> Event |
Your monitoring tools should send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the provided incident_key.
client :: Lens' Trigger (Maybe Text) Source
The name of the monitoring client that is triggering this event.
clientUrl :: Lens' Trigger (Maybe Text) Source
The URL of the monitoring client that is triggering this event.
Acknowledge
type Acknowledge = Generic Source
:: ServiceKey | |
-> IncidentKey | |
-> Event |
Acknowledge events cause the referenced incident to enter the acknowledged state.
While an incident is acknowledged, it won't generate any additional notifications, even if it receives new trigger events. Your monitoring tools should send PagerDuty an acknowledge event when they know someone is presently working on the problem.
Resolve
:: ServiceKey | |
-> IncidentKey | |
-> Event |
Resolve events cause the referenced incident to enter the resolved state.
Once an incident is resolved, it won't generate any additional notifications. New trigger events with the same incident_key as a resolved incident won't re-open the incident. Instead, a new incident will be created. Your monitoring tools should send PagerDuty a resolve event when the problem that caused the initial trigger event has been fixed.
Event fields
class HasServiceKey s a | s -> a where Source
serviceKey :: Lens' s a Source
The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page.
class HasIncidentKey s a | s -> a where Source
incidentKey :: Lens' s a Source
Identifies the incident to which this trigger event should be applied. If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to "de-dup" problem reports. If this field isn't provided, PagerDuty will automatically open a new incident with a unique key.
class HasDescription s a | s -> a where Source
description :: Lens' s a Source
A short description of the problem that led to this trigger. This field (or a truncated version) will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The maximum length is 1024 characters.
HasDescription Trigger Text |
class HasDetails s a | s -> a where Source
An arbitrary JSON object containing any data you'd like included in the incident log.
HasDetails Trigger (Maybe Object) | |
HasDetails Event (Maybe Object) |
Types
Trigger Trigger | See: |
Acknowledge Generic | See: |
Resolve Generic | See: |
_Acknowledge :: Prism' Event Generic Source
rsIncidentKey :: Lens' Response IncidentKey Source
The key of the incident that will be affected by the request.