Documentation

zenoss.event() function

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

The zenoss.event() function sends an event to Zenoss.

import "contrib/bonitoo-io/zenoss"

zenoss.event(
  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,
  summary: "",
  device: "",
  component: "",
  severity: "Critical",
  eventClass: "",
  eventClassKey: "",
  collector: "",
  message: ""
)

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

summary

Event summary. Default is "".

Data type: String

device

Related device. Default is "".

Data type: String

component

Related component. Default is "".

Data type: String

severity

(Required) Event severity level.

Data type: String

Supported values:

  • Critical
  • Warning
  • Info
  • Clear

eventClass

Event class. Default is "".

Data type: String

eventClassKey

Event class key. Default is "".

Data type: String

collector

Zenoss collector. Default is "".

Data type: String

message

Related message. Default is "".

Data type: String

Examples

Send the last reported value and severity to Zenoss
import "contrib/bonitoo-io/zenoss"
import "influxdata/influxdb/secrets"

username = secrets.get(key: "ZENOSS_USERNAME")
password = secrets.get(key: "ZENOSS_PASSWORD")

lastReported =
  from(bucket: "example-bucket")
    |> range(start: -1m)
    |> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_idle")
    |> last()
    |> findRecord(fn: (key) => true, idx: 0)

zenoss.event(
    url: "https://tenant.zenoss.io:8080/zport/dmd/evconsole_router",
    username: username,
    username: password,
    device: lastReported.host,
    component: "CPU",
    eventClass: "/App",
    severity:
      if lastReported._value < 1.0 then "Critical"
      else if lastReported._value < 5.0 then "Warning"
      else if lastReported._value < 20.0 then "Info"
      else "Clear"
)

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.