pagerduty.endpoint() function

The pagerduty.endpoint() function sends a message to PagerDuty that includes output data.

Function type: Output

import "pagerduty"

  url: ""



The PagerDuty API URL. Defaults to

Data type: String


pagerduty.endpoint is a factory function that outputs another function. The output function requires a mapFn parameter.


(Required) A function that builds the record used to generate the POST request. Requires an r parameter.

Data type: Function

mapFn accepts a table row (r) and returns a record that must include the following fields:

  • routingKey
  • client
  • client_url
  • class
  • eventAction
  • group
  • severity
  • component
  • source
  • summary
  • timestamp

For more information, see pagerduty.sendEvent()


Send critical statuses to a PagerDuty endpoint
import "pagerduty"
import "influxdata/influxdb/secrets"

token = secrets.get(key: "PAGERDUTY_TOKEN")
toPagerDuty = pagerduty.endpoint(token: token)

crit_statuses = from(bucket: "example-bucket")
  |> range(start: -1m)
  |> filter(fn: (r) => r._measurement == "statuses" and r.status == "crit")

  |> toPagerDuty(mapFn: (r) => ({ r with
      routingKey: r.routingKey,
      client: r.client,
      clientURL: r.clientURL,
      class: r.class,
      eventAction: r.eventAction,
      severity: r.severity,
      component: r.component,
      source: r.source,
      summary: r.summary,
      timestamp: r._time,

Cloud or OSS?

InfluxDB OSS 2.0 now generally available!

InfluxDB OSS 2.0 is now generally available and ready for production use. See the InfluxDB OSS 2.0 release notes.

For information about upgrading to InfluxDB OSS 2.0, see: