alerta.endpoint() function

alerta.endpoint() is a user-contributed function maintained by the package author.

alerta.endpoint() sends alerts to Alerta using data from input rows.


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


A function that builds the object used to generate the POST request. Requires an r parameter.

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

  • resource
  • event
  • severity
  • service
  • group
  • value
  • text
  • tags
  • attributes
  • type
  • timestamp

For more information, see alerta.alert() parameters.

Function type signature
    apiKey: string,
    url: string,
    ?environment: A,
    ?origin: B,
) => (
    mapFn: (
        r: C,
    ) => {
        D with
        value: O,
        type: N,
        timestamp: M,
        text: L,
        tags: K,
        severity: J,
        service: I,
        resource: H,
        group: G,
        event: F,
        attributes: E,
) => (<-tables: stream[C]) => stream[{C with _sent: string}]
For more information, see Function type signatures.



(Required) (Required) Alerta URL.


(Required) (Required) Alerta API key.


Alert environment. Default is "". Valid values: “Production”, “Development”, or empty string (default).


Alert origin. Default is "InfluxDB".


Send critical alerts to Alerta

import "contrib/bonitoo-io/alerta"
import "influxdata/influxdb/secrets"

apiKey = secrets.get(key: "ALERTA_API_KEY")
endpoint =
        url: "",
        apiKey: apiKey,
        environment: "Production",
        origin: "InfluxDB",

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

    |> endpoint(
        mapFn: (r) => {
            return {r with
                resource: "example-resource",
                event: "example-event",
                severity: "critical",
                service: r.service,
                group: "example-group",
                value: r.status,
                text: "Status is critical.",
                tags: ["ex1", "ex2"],
                attributes: {},
                type: "exampleAlertType",
                timestamp: now(),

Was this page helpful?

Thank you for your feedback!

Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Learn more
Contact InfluxData Sales

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following:

State of the InfluxDB Cloud Serverless documentation

InfluxDB Cloud Serverless documentation is a work in progress.

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.