new Alerter(opts)
A PagerDuty service capable of notifying multiple accounts, throttling and filtering alerts
Parameters:
Name | Type | Description |
---|---|---|
opts |
Alerter~createOptions | configuration options |
Methods
alert(name, optsopt, callbackopt)
invoked when an event has occurred; depending on the situation this may result in pagerduty incidents being created or resolved
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | name of event that has occurred |
|
opts |
Alerter~alertOptions |
<optional> |
options |
callback |
Alerter~alertCallback |
<optional> |
callback that receives information about the operation |
Type Definitions
alertCallback(err, event, throttled, sent, resolved)
This callback is invoked to return information when Alerter#alert
is invoked.
Parameters:
Name | Type | Description |
---|---|---|
err |
Error | if an error occurred while attempting to create an incident on pagerduty |
event |
Object | the defined event that was alerted |
throttled |
boolean | true if the event was throttled and no pagerduty incident was created |
sent |
number | number of pagerduty incidents created |
resolved |
number | number of pagerduty incidents resolved |
alertOptions
options passed to the Alerter#alert
method
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
target |
string |
<optional> |
identifier for a specific instance of an event of a given name (e.g. 'LOST-DB-CONNECTION' may have targets 'primary-db' and 'backup-db'). The target property is only needed to disambiguate when resolving incidents pertaining to a specific resource. |
level |
number |
<optional> |
severity level for this alert |
details |
Object |
<optional> |
any details to pass on to pagerduty when creating an incident |
createOptions
Constructor options
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
events |
Alerter~definedEvents |
<optional> |
Array of events |
serviceKeys |
Alerter~serviceKeys | Array of service keys |
definedEvents
Array of event definitions
Type:
- Array
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | event name |
|
description |
string |
<optional> |
event description |
level |
number |
<optional> |
severity level (non-negative integer; higher values infer greater severity) - default: highest severity |
notify |
boolean |
<optional> |
whether or not to send an alert to pagerduty (default: true) |
resolves |
Array | string |
<optional> |
name(s) of events that this event should resolve on pagerduty |
throttle |
string |
<optional> |
minimum interval between successive pagerduty alerts (format: "45 secs" or "5 mins"); default is no throttling |
serviceKeys
Array of information about pagerduty service keys
Type:
- Array
Properties:
Name | Type | Description |
---|---|---|
key |
string | Object | either a single pagerduty service key, or an object with a 'level' and 'keys' property -- in the latter case, 'level' indicates the minimum severity level for which pagerduty alerts will be generated for these keys; keys is an array of pagerduty service keys |