Documentation

zenoss.endpoint() function

The zenoss.endpoint() function is a user-contributed function maintained by the package author and can be updated or removed at any time.

The zenoss.endpoint() function sends events to Zenoss using data from input rows.

Function type: Output

import "contrib/bonitoo-io/zenoss"

zenoss.endpoint(
  url: "https://example.zenoss.io:8080/zport/dmd/evconsole_router",
  username: "example-user",
  password: "example-password",
  action: "EventsRouter",
  method: "add_event",
  type: "rpc",
  tid: 1
)

Parameters

url

(Required) Zenoss router endpoint URL.

Data type: String

username

(Required) Zenoss username to use for HTTP BASIC authentication. Default is "" (no authentication).

Data type: String

password

(Required) Zenoss password to use for HTTP BASIC authentication. Default is "" (no authentication).

Data type: String

action

Zenoss router name. Default is "EventsRouter".

Data type: String

method

EventsRouter method. Default is "add_event".

Data type: String

type

Event type. Default is "rpc".

Data type: String

tid

Temporary request transaction ID. Default is 1.

Data type: Integer

Usage

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

mapFn

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

Data type: Function

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

  • summary
  • device
  • component
  • severity
  • eventClass
  • eventClassKey
  • collector
  • message

For more information, see zenoss.event() parameters.

Examples

Send critical events to Zenoss
import "contrib/bonitoo-io/zenoss"
import "influxdata/influxdb/secrets"

url = "https://tenant.zenoss.io:8080/zport/dmd/evconsole_router"
username = secrets.get(key: "ZENOSS_USERNAME")
password = secrets.get(key: "ZENOSS_PASSWORD")
endpoint = zenoss.endpoint(
  url: url,
  username: username,
  password: password
)

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

crit_events
  |> endpoint(mapFn: (r) => ({
      summary: "Critical event for ${r.host}",
      device: r.deviceID,
      component: r.host,
      severity: "Critical",
      eventClass: "/App",
      eventClassKey: "",
      collector: "",
      message: "${r.host} is in a critical state.",
    })
  )()

Package author and maintainer

Github: @alespour, @bonitoo-io
InfluxDB Slack: @Ales Pour


Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.