1.7 KiB
1.7 KiB
title | description | aliases | menu | weight | v2.0/tags | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pagerduty.endpoint() function | The `pagerduty.endpoint()` function sends a message to PagerDuty that includes output data. |
|
|
202 |
|
The pagerduty.endpoint()
function sends a message to PagerDuty that includes output data.
Function type: Output
import "pagerduty"
pagerduty.endpoint(
url: "https://events.pagerduty.com/v2/enqueue"
)
Parameters
pagerdutyURL
The PagerDuty API URL.
Defaults to https://events.pagerduty.com/v2/enqueue
.
Data type: String
mapFn
A function that builds the object used to generate the POST request.
{{% note %}}
You should rarely need to override the default mapFn
parameter.
To see the default mapFn
value or for insight into possible overrides, view the
pagerduty.endpoint()
source code.
{{% /note %}}
Data type: Function
The returned object must include the following fields:
routingKey
client
client_url
class
group
severity
component
source
summary
timestamp
For more information, see pagerduty.sendEvent()
Examples
Send critical statuses to a PagerDuty endpoint
import "monitor"
import "pagerduty"
endpoint = pagerduty.endpoint(token: "mySuPerSecRetTokEn")
from(bucket: "example-bucket")
|> range(start: -1m)
|> filter(fn: (r) => r._measurement == "statuses" and status == "crit")
|> map(fn: (r) => { return {r with status: r._status} })
|> monitor.notify(endpoint: endpoint)