From 37e28bd1289cfca6316653f5df1d9089cef4515d Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 17 Mar 2021 08:51:41 -0600 Subject: [PATCH] Flux 0.108 (#2305) * flux 0.108 changelog * Flux VictorOps package (#2295) * added flux victorops package, closes #2277 * added cloud version of victorops pkg * Flux Zenoss pkg (#2292) * added zenoss package, closes #2278 * added cloud duplicates for zenoss package * updated zenoss pkg to address PR feedback * Apply suggestions from code review Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * Flux BigPanda package (#2301) * added flux bigpanda package, closes #2279 * added cloud version of bigpanda package * added information to bigpanda pkg about converting timestamps * Update content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/_index.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> * added 0.108 package links to flux changelog * added flux 0.108.1 to flux changelog Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> --- .../flux/stdlib/contrib/bigpanda/_index.md | 15 ++ .../flux/stdlib/contrib/bigpanda/endpoint.md | 12 ++ .../flux/stdlib/contrib/bigpanda/sendAlert.md | 12 ++ .../contrib/bigpanda/statusfromlevel.md | 12 ++ .../flux/stdlib/contrib/victorops/_index.md | 15 ++ .../flux/stdlib/contrib/victorops/endpoint.md | 12 ++ .../flux/stdlib/contrib/victorops/event.md | 12 ++ .../flux/stdlib/contrib/zenoss/_index.md | 15 ++ .../flux/stdlib/contrib/zenoss/endpoint.md | 12 ++ .../flux/stdlib/contrib/zenoss/event.md | 12 ++ .../flux/stdlib/contrib/bigpanda/_index.md | 60 ++++++ .../flux/stdlib/contrib/bigpanda/endpoint.md | 96 ++++++++++ .../flux/stdlib/contrib/bigpanda/sendAlert.md | 101 ++++++++++ .../contrib/bigpanda/statusfromlevel.md | 46 +++++ .../flux/stdlib/contrib/victorops/_index.md | 45 +++++ .../flux/stdlib/contrib/victorops/endpoint.md | 99 ++++++++++ .../flux/stdlib/contrib/victorops/event.md | 125 +++++++++++++ .../flux/stdlib/contrib/zenoss/_index.md | 31 ++++ .../flux/stdlib/contrib/zenoss/endpoint.md | 138 ++++++++++++++ .../flux/stdlib/contrib/zenoss/event.md | 172 ++++++++++++++++++ .../v2.0/reference/release-notes/flux.md | 16 ++ 21 files changed, 1058 insertions(+) create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/endpoint.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/sendAlert.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/endpoint.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/event.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/_index.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/endpoint.md create mode 100644 content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/event.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/_index.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/endpoint.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/sendAlert.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/_index.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/endpoint.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/event.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/_index.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/endpoint.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/event.md diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/_index.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/_index.md new file mode 100644 index 000000000..e0391dc50 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/_index.md @@ -0,0 +1,15 @@ +--- +title: Flux BigPanda package +list_title: BigPanda package +description: > + The Flux BigPanda package provides functions that send alerts to + [BigPanda](https://www.bigpanda.io/). +menu: + influxdb_cloud_ref: + name: BigPanda + parent: Contributed +weight: 202 +influxdb/cloud/tags: [functions, bigpanda, package] +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/endpoint.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/endpoint.md new file mode 100644 index 000000000..ee6894ada --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/endpoint.md @@ -0,0 +1,12 @@ +--- +title: bigpanda.endpoint() function +description: > + The `bigpanda.endpoint()` function sends alerts to BigPanda using data from input rows. +menu: + influxdb_cloud_ref: + name: bigpanda.endpoint + parent: BigPanda +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/sendAlert.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/sendAlert.md new file mode 100644 index 000000000..4c8f8a3cb --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/sendAlert.md @@ -0,0 +1,12 @@ +--- +title: bigpanda.sendAlert() function +description: > + The `bigpanda.sendAlert()` function sends an alert to BigPanda. +menu: + influxdb_cloud_ref: + name: bigpanda.sendAlert + parent: BigPanda +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md new file mode 100644 index 000000000..84065d56f --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md @@ -0,0 +1,12 @@ +--- +title: bigpanda.statusFromLevel() function +description: > + The `bigpanda.statusFromLevel()` function converts an alert level into a BigPanda status. +menu: + influxdb_cloud_ref: + name: bigpanda.statusFromLevel + parent: BigPanda +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/_index.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/_index.md new file mode 100644 index 000000000..3cc1b8ff9 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/_index.md @@ -0,0 +1,15 @@ +--- +title: Flux VictorOps package +list_title: VictorOps package +description: > + The Flux VictorOps package provides functions that send events to + [VictorOps](#). +menu: + influxdb_cloud_ref: + name: VictorOps + parent: Contributed +weight: 202 +influxdb/cloud/tags: [functions, victorops, package] +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/endpoint.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/endpoint.md new file mode 100644 index 000000000..08bbfe412 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/endpoint.md @@ -0,0 +1,12 @@ +--- +title: victorops.endpoint() function +description: > + The `victorops.endpoint()` function sends events to VictorOps using data from input rows. +menu: + influxdb_cloud_ref: + name: victorops.endpoint + parent: VictorOps +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/event.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/event.md new file mode 100644 index 000000000..9c10fc1c1 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/victorops/event.md @@ -0,0 +1,12 @@ +--- +title: victorops.event() function +description: > + The `victorops.event()` function sends an event to VictorOps. +menu: + influxdb_cloud_ref: + name: victorops.event + parent: VictorOps +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/_index.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/_index.md new file mode 100644 index 000000000..e61bde3a8 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/_index.md @@ -0,0 +1,15 @@ +--- +title: Flux Zenoss package +list_title: Zenoss package +description: > + The Flux Zenoss package provides functions that send events to + [Zenoss](https://www.zenoss.com/). +menu: + influxdb_cloud_ref: + name: Zenoss + parent: Contributed +weight: 202 +influxdb/cloud/tags: [functions, zenoss, package] +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/endpoint.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/endpoint.md new file mode 100644 index 000000000..ba950a675 --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/endpoint.md @@ -0,0 +1,12 @@ +--- +title: zenoss.endpoint() function +description: > + The `zenoss.endpoint()` function sends events to Zenoss using data from input rows. +menu: + influxdb_cloud_ref: + name: zenoss.endpoint + parent: Zenoss +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/event.md b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/event.md new file mode 100644 index 000000000..6533b5e6e --- /dev/null +++ b/content/influxdb/cloud/reference/flux/stdlib/contrib/zenoss/event.md @@ -0,0 +1,12 @@ +--- +title: zenoss.event() function +description: > + The `zenoss.event()` function sends an event to Zenoss. +menu: + influxdb_cloud_ref: + name: zenoss.event + parent: Zenoss +weight: 202 +--- + +{{< duplicate-oss >}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/_index.md new file mode 100644 index 000000000..11c1c939b --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/_index.md @@ -0,0 +1,60 @@ +--- +title: Flux BigPanda package +list_title: BigPanda package +description: > + The Flux BigPanda package provides functions that send alerts to + [BigPanda](https://www.bigpanda.io/). +menu: + influxdb_2_0_ref: + name: BigPanda + parent: Contributed +weight: 202 +influxdb/v2.0/tags: [functions, bigpanda, package] +--- + +The Flux BigPanda package provides functions that send alerts to +[BigPanda](https://www.bigpanda.io/). +Import the `contrib/rhajek/bigpanda` package: + +```js +import "contrib/rhajek/bigpanda" +``` + +## Options +The BigPanda package provides the following options: + +- [defaultURL](#defaulturl) +- [defaultTokenPrefix](#defaulttokenprefix) + +```js +import "contrib/rhajek/bigpanda" + +option bigpanda.defaultUrl = "https://api.bigpanda.io/data/v2/alerts" +option bigpanda.defaultTokenPrefix = "Bearer" +``` + +### defaultUrl +The default [BigPanda alerts API URL](https://docs.bigpanda.io/reference#alerts-how-it-works) +for functions in the BigPanda package. +Default is `https://api.bigpanda.io/data/v2/alerts`. + +### defaultTokenPrefix +The default HTTP authentication schema to use when authenticating with BigPanda. +Default is `Bearer`. + +## Functions +{{< children type="functions" show="pages" >}} + +## Send alert timestamps to BigPanda +Sending alert timestamps to BigPanda is optional, but if you choose to send them, +convert timestamps to **epoch second timestamps**: + +```js +// + |> map(fn: (r) => ({ r with secTime: int(v: r._time) / 1000000000 })) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@rhajek](https://github.com/rhajek), [@bonitoo-io](https://github.com/bonitoo-io) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/endpoint.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/endpoint.md new file mode 100644 index 000000000..c7499c0dc --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/endpoint.md @@ -0,0 +1,96 @@ +--- +title: bigpanda.endpoint() function +description: > + The `bigpanda.endpoint()` function sends alerts to BigPanda using data from input rows. +menu: + influxdb_2_0_ref: + name: bigpanda.endpoint + parent: BigPanda +weight: 202 +--- + +The `bigpanda.endpoint()` function sends alerts to [BigPanda](https://www.bigpanda.io/) +using data from input rows. + +_**Function type:** Output_ + +```js +import "contrib/rhajek/bigpanda" + +bigpanda.endpoint( + url: "https://api.bigpanda.io/data/v2/alerts", + token: "my5uP3rS3cRe7t0k3n", + appKey: "example-app-key" +) +``` + +## Parameters + +### url +BigPanda [alerts API URL](https://docs.bigpanda.io/reference#alerts-how-it-works). +Default is the value of the [`bigpanda.defaultURL` option](/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/#defaulturl). + +_**Data type:** String_ + +### token +({{< req >}}) +BigPanda [API Authorization token (API key)](https://docs.bigpanda.io/docs/api-key-management). + +_**Data type:** String_ + +### appKey +({{< req >}}) +BigPanda [App Key](https://docs.bigpanda.io/reference#integrating-monitoring-systems). + +## Usage +`bigpanda.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: + +- `status` +- Additional [alert parameters](https://docs.bigpanda.io/reference#alert-object) + to send to the BigPanda alert API. + +_For more information, see [`bigpanda.sendAlert()` parameters](/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/sendalert/#parameters)._ + +## Examples + +##### Send critical alerts to BigPanda +```js +import "contrib/rhajek/bigpanda" +import "influxdata/influxdb/secrets" +import "json" + +token = secrets.get(key: "BIGPANDA_API_KEY") +endpoint = bigpanda.endpoint( + token: token, + appKey: "example-app-key" +) + +crit_events = from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses" and status == "crit") + +crit_events + |> endpoint(mapFn: (r) => { + return { r with + status: "critical", + check: "critical-status-check", + description: "${r._field} is critical: ${string(v: r._value)}" + tags: json.encode(v: [{"name": "host", "value": r.host}]), + } + })() +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@rhajek](https://github.com/rhajek), [@bonitoo-io](https://github.com/bonitoo-io) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/sendAlert.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/sendAlert.md new file mode 100644 index 000000000..26b2edc65 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/sendAlert.md @@ -0,0 +1,101 @@ +--- +title: bigpanda.sendAlert() function +description: > + The `bigpanda.sendAlert()` function sends an alert to BigPanda. +menu: + influxdb_2_0_ref: + name: bigpanda.sendAlert + parent: BigPanda +weight: 202 +--- + +The `bigpanda.sendAlert()` function sends an alert to [BigPanda](https://www.bigpanda.io/). + +```js +import "contrib/rhajek/bigpanda" + +bigpanda.sendAlert( + url: "https://api.bigpanda.io/data/v2/alerts", + token: "my5uP3rS3cRe7t0k3n", + appKey: "example-app-key", + status: "critical", + rec: {}, +) +``` + +## Parameters + +### url +BigPanda [alerts API URL](https://docs.bigpanda.io/reference#alerts-how-it-works). +Default is the value of the [`bigpanda.defaultURL` option](/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/#defaulturl). + +_**Data type:** String_ + +### token +({{< req >}}) +BigPanda [API Authorization token (API key)](https://docs.bigpanda.io/docs/api-key-management). + +_**Data type:** String_ + +### appKey +({{< req >}}) +BigPanda [App Key](https://docs.bigpanda.io/reference#integrating-monitoring-systems). + +_**Data type:** String_ + +### status +({{< req >}}) +BigPanda [alert status](https://docs.bigpanda.io/reference#alerts). + +_**Data type:** String_ + +**Supported statuses:** + +- `ok` +- `critical` +- `warning` +- `acknowledged` + +### rec +({{< req >}}) +Additional [alert parameters](https://docs.bigpanda.io/reference#alert-object) +to send to the BigPanda alert API. + +_**Data type:** Record_ + +## Examples + +##### Send the last reported value and status to BigPanda +```js +import "contrib/rhajek/bigpanda" +import "influxdata/influxdb/secrets" +import "json" + +token = secrets.get(key: "BIGPANDA_API_KEY") + +lastReported = + from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => + r._measurement == "example-measurement" and + r._field == "level" + ) + |> last() + |> findRecord(fn: (key) => true, idx: 0) + +bigpanda.sendAlert( + token: token, + appKey: "example-app-key", + status: bigpanda.statusFromLevel(level: "${lastReported.status}"), + rec: { + tags: json.encode(v: [{"name": "host", "value": "my-host"}]), + check: "my-check", + description: "${lastReported._field} is ${lastReported.status}: ${string(v: lastReported._value)}" + } +) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@rhajek](https://github.com/rhajek), [@bonitoo-io](https://github.com/bonitoo-io) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md new file mode 100644 index 000000000..8b0acd5aa --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/statusfromlevel.md @@ -0,0 +1,46 @@ +--- +title: bigpanda.statusFromLevel() function +description: > + The `bigpanda.statusFromLevel()` function converts an alert level into a BigPanda status. +menu: + influxdb_2_0_ref: + name: bigpanda.statusFromLevel + parent: BigPanda +weight: 202 +--- + +The `bigpanda.statusFromLevel()` function converts an alert level into a BigPanda status. + +```js +import "contrib/rhajek/bigpanda" + +bigpanda.statusFromLevel(level: "crit") + +// Returns "critical" +``` + +## Parameters + +### level +({{< req >}}) +Alert level. + +_**Data type:** String_ + +##### Supported alert levels + +| Alert level | BigPanda status | +|:-----------:|:---------------:| +| crit | critical | +| warn | warning | +| info | ok | +| ok | ok | + +_Default BigPanda status is `critical`._ + + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/_index.md new file mode 100644 index 000000000..70cf595f4 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/_index.md @@ -0,0 +1,45 @@ +--- +title: Flux VictorOps package +list_title: VictorOps package +description: > + The Flux VictorOps package provides functions that send events to + [VictorOps](#). +menu: + influxdb_2_0_ref: + name: VictorOps + parent: Contributed +weight: 202 +influxdb/v2.0/tags: [functions, victorops, package] +--- + +The Flux VictorOps package provides functions that send events to +[VictorOps](https://victorops.com). + +{{% note %}} +#### VictorOps is now Splunk On-Call +Splunk acquired VictorOps and VictorOps is now +[Splunk On-Call](https://www.splunk.com/en_us/investor-relations/acquisitions/splunk-on-call.html). +{{% /note %}} + +Import the `contrib/bonitoo-io/victorops` package: + +```js +import "contrib/bonitoo-io/victorops" +``` + +## Set up VictorOps +To send events to VictorOps with Flux: + +1. [Enable the VictorOps REST Endpoint Integration](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/). +2. [Create a REST integration routing key](https://help.victorops.com/knowledge-base/routing-keys/). +3. [Create a VictorOps API key](https://help.victorops.com/knowledge-base/api/). + +## Functions + +{{< children type="functions" show="pages" >}} + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/endpoint.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/endpoint.md new file mode 100644 index 000000000..60821537f --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/endpoint.md @@ -0,0 +1,99 @@ +--- +title: victorops.endpoint() function +description: > + The `victorops.endpoint()` function sends events to VictorOps using data from input rows. +menu: + influxdb_2_0_ref: + name: victorops.endpoint + parent: VictorOps +weight: 202 +--- + +The `victorops.endpoint()` function sends events to VictorOps using data from input rows. + +_**Function type:** Output_ + +{{% note %}} +#### VictorOps is now Splunk On-Call +Splunk acquired VictorOps and VictorOps is now +[Splunk On-Call](https://www.splunk.com/en_us/investor-relations/acquisitions/splunk-on-call.html). +{{% /note %}} + +```js +import "contrib/bonitoo-io/victorops" + +victorops.endpoint( + url: "https://alert.victorops.com/integrations/generic/00000000/alert${apiKey}/${routingKey}", +) +``` + +## Parameters + +### url +({{< req >}}) +[VictorOps REST endpoint integration URL](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/). + +_**Data type:** String_ + +##### VictorOps URL example +``` +https://alert.victorops.com/integrations/generic/00000000/alert// +``` + +_Replace `` and `` with valid VictorOps API and routing keys._ + +## Usage +`victorops.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: + +- `monitoringTool` +- `messageType` +- `entityID` +- `entityDisplayName` +- `stateMessage` +- `timestamp` + +_For more information, see [`victorops.event()` parameters](/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/event/#parameters)._ + +## Examples + +##### Send critical events to VictorOps +```js +import "contrib/bonitoo-io/victorops" +import "influxdata/influxdb/secrets" + +apiKey = secrets.get(key: "VICTOROPS_API_KEY") +routingKey = secrets.get(key: "VICTOROPS_ROUTING_KEY") +url = "https://alert.victorops.com/integrations/generic/00000000/alert/${apiKey}/${routingKey}" +endpoint = victorops.endpoint(url: url) + +crit_events = from(bucket: "example-bucket") + |> range(start: -1m) + |> filter(fn: (r) => r._measurement == "statuses" and status == "crit") + +crit_events + |> endpoint(mapFn: (r) => ({ + monitoringTool: "InfluxDB" + messageType: "CRITICAL", + entityID: "${r.host}-${r._field)-critical", + entityDisplayName: "Critical alert for ${r.host}", + stateMessage: "${r.host} is in a critical state. ${r._field} is ${string(v: r._value)}.", + timestamp: now() + }) + )() +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/event.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/event.md new file mode 100644 index 000000000..fa6bf1463 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/event.md @@ -0,0 +1,125 @@ +--- +title: victorops.event() function +description: > + The `victorops.event()` function sends an event to VictorOps. +menu: + influxdb_2_0_ref: + name: victorops.event + parent: VictorOps +weight: 202 +--- + +The `victorops.event()` function sends an event to [VictorOps](https://www.victorops.com/). + +{{% note %}} +#### VictorOps is now Splunk On-Call +Splunk acquired VictorOps and VictorOps is now +[Splunk On-Call](https://www.splunk.com/en_us/investor-relations/acquisitions/splunk-on-call.html). +{{% /note %}} + +```js +import "contrib/bonitoo-io/victorops" + +victorops.event( + url: "https://alert.victorops.com/integrations/generic/00000000/alert/${api_key}/${routing_key}", + monitoringTool: "", + messageType: "CRITICAL", + entityID: "", + entityDisplayName: "", + stateMessage: "", + timestamp: now() +) +``` + +## Parameters + +### url +({{< req >}}) +[VictorOps REST endpoint integration URL](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/). + +_**Data type:** String_ + +##### VictorOps URL example +``` +https://alert.victorops.com/integrations/generic/00000000/alert// +``` + +_Replace `` and `` with valid VictorOps API and routing keys._ + +### monitoringTool +Monitoring agent name. +Default is `""`. + +_**Data type:** String_ + +### messageType +({{< req >}}) +VictorOps [message type](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#recommended-rest-endpoint-integration-fields) +(alert behavior). + +_**Data type:** String_ + +**Valid values:** + +- `CRITICAL` +- `WARNING` +- `INFO` + +### entityID +[Incident ID](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#recommended-rest-endpoint-integration-fields). +Default is `""`. + +_**Data type:** String_ + +### entityDisplayName +[Incident display name or summary](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#recommended-rest-endpoint-integration-fields). +Default is `""`. + +_**Data type:** String_ + +### stateMessage +[Verbose incident message](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#recommended-rest-endpoint-integration-fields). +Default is `""`. + +_**Data type:** String_ + +### timestamp +[Incident start time](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/#recommended-rest-endpoint-integration-fields). +Default is `now()`. + +_**Data type:** Time_ + +## Examples + +##### Send the last reported value and incident type to VictorOps +```js +import "contrib/bonitoo-io/victorops" +import "influxdata/influxdb/secrets" + +apiKey = secrets.get(key: "VICTOROPS_API_KEY") +routingKey = secrets.get(key: "VICTOROPS_ROUTING_KEY") + +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) + +victorops.event( + url: "https://alert.victorops.com/integrations/generic/00000000/alert/${apiKey}/${routingKey}", + messageType: + if lastReported._value < 1.0 then "CRITICAL" + else if lastReported._value < 5.0 then "WARNING" + else "INFO", + entityID: "example-alert-1", + entityDisplayName: "Example Alert 1", + stateMessage: "Last reported cpu_idle was ${string(v: r._value)}." +) +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/_index.md new file mode 100644 index 000000000..1fc1983b6 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/_index.md @@ -0,0 +1,31 @@ +--- +title: Flux Zenoss package +list_title: Zenoss package +description: > + The Flux Zenoss package provides functions that send events to + [Zenoss](https://www.zenoss.com/). +menu: + influxdb_2_0_ref: + name: Zenoss + parent: Contributed +weight: 202 +influxdb/v2.0/tags: [functions, zenoss, package] +--- + +The Flux Zenoss package provides functions that send events to +[Zenoss](https://www.zenoss.com/). +Import the `contrib/bonitoo-io/zenoss` package: + +```js +import "contrib/bonitoo-io/zenoss" +``` + +## Functions + +{{< children type="functions" show="pages" >}} + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/endpoint.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/endpoint.md new file mode 100644 index 000000000..49c4d9478 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/endpoint.md @@ -0,0 +1,138 @@ +--- +title: zenoss.endpoint() function +description: > + The `zenoss.endpoint()` function sends events to Zenoss using data from input rows. +menu: + influxdb_2_0_ref: + name: zenoss.endpoint + parent: Zenoss +weight: 202 +--- + +The `zenoss.endpoint()` function sends events to Zenoss using data from input rows. + +_**Function type:** Output_ + +```js +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 +({{< req >}}) +Zenoss [router endpoint URL](https://help.zenoss.com/zsd/RM/configuring-resource-manager/enabling-access-to-browser-interfaces/creating-and-changing-public-endpoints). + +_**Data type:** String_ + +### username +({{< req >}}) +Zenoss username to use for HTTP BASIC authentication. +Default is `""` (no authentication). + +_**Data type:** String_ + +### password +({{< req >}}) +Zenoss password to use for HTTP BASIC authentication. +Default is `""` (no authentication). + +_**Data type:** String_ + +### action +Zenoss [router name](https://help.zenoss.com/dev/collection-zone-and-resource-manager-apis/anatomy-of-an-api-request#AnatomyofanAPIrequest-RouterURL). +Default is `"EventsRouter"`. + +_**Data type:** String_ + +### method +[EventsRouter method](https://help.zenoss.com/dev/collection-zone-and-resource-manager-apis/codebase/routers/router-reference/eventsrouter). +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](/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/event/#parameters)._ + +## Examples + +##### Send critical events to Zenoss +```js +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.", + }) + )() +``` + +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/event.md b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/event.md new file mode 100644 index 000000000..3afa3a9aa --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/event.md @@ -0,0 +1,172 @@ +--- +title: zenoss.event() function +description: > + The `zenoss.event()` function sends an event to Zenoss. +menu: + influxdb_2_0_ref: + name: zenoss.event + parent: Zenoss +weight: 202 +--- + +The `zenoss.event()` function sends an event to [Zenoss](https://www.zenoss.com/). + +```js +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 +({{< req >}}) +Zenoss [router endpoint URL](https://help.zenoss.com/zsd/RM/configuring-resource-manager/enabling-access-to-browser-interfaces/creating-and-changing-public-endpoints). + +_**Data type:** String_ + +### username +({{< req >}}) +Zenoss username to use for HTTP BASIC authentication. +Default is `""` (no authentication). + +_**Data type:** String_ + +### password +({{< req >}}) +Zenoss password to use for HTTP BASIC authentication. +Default is `""` (no authentication). + +_**Data type:** String_ + +### action +Zenoss [router name](https://help.zenoss.com/dev/collection-zone-and-resource-manager-apis/anatomy-of-an-api-request#AnatomyofanAPIrequest-RouterURL). +Default is `"EventsRouter"`. + +_**Data type:** String_ + +### method +[EventsRouter method](https://help.zenoss.com/dev/collection-zone-and-resource-manager-apis/codebase/routers/router-reference/eventsrouter). +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 +({{< req >}}) +[Event severity level](https://help.zenoss.com/zsd/RM/administering-resource-manager/event-management/event-severity-levels). + +_**Data type:** String_ + +**Supported values:** + +- Critical +- Warning +- Info +- Clear + +### eventClass +[Event class](https://help.zenoss.com/zsd/RM/administering-resource-manager/event-management/understanding-event-classes). +Default is `""`. + +_**Data type:** String_ + +### eventClassKey +Event [class key](https://help.zenoss.com/zsd/RM/administering-resource-manager/event-management/event-fields). +Default is `""`. + +_**Data type:** String_ + +### collector +Zenoss [collector](https://help.zenoss.com/zsd/RM/administering-resource-manager/event-management/event-fields). +Default is `""`. + +_**Data type:** String_ + +### message +Related message. +Default is `""`. + +_**Data type:** String_ + +## Examples + +##### Send the last reported value and severity to Zenoss +```js +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" +) +``` +{{% note %}} +#### Package author and maintainer +**Github:** [@alespour](https://github.com/alespour), [@bonitoo-io](https://github.com/bonitoo-io) +**InfluxDB Slack:** [@Ales Pour](https://influxdata.com/slack) +{{% /note %}} diff --git a/content/influxdb/v2.0/reference/release-notes/flux.md b/content/influxdb/v2.0/reference/release-notes/flux.md index 42c1d1e0d..938c861a7 100644 --- a/content/influxdb/v2.0/reference/release-notes/flux.md +++ b/content/influxdb/v2.0/reference/release-notes/flux.md @@ -8,6 +8,22 @@ menu: name: Flux --- +## v0.108.1 [2021-03-15] +- _Internal code cleanup._ + +--- + +## v0.108.0 [2021-03-15] + +### Features +- Add [BigPanda notification support](/influxdb/v2.0/reference/flux/stdlib/contrib/bigpanda/). +- Add [Zenoss notifications support](/influxdb/v2.0/reference/flux/stdlib/contrib/zenoss/). +- Add [VictorOps notifications support](/influxdb/v2.0/reference/flux/stdlib/contrib/victorops/). + +### Bug fixes +- Classify "Option not found error" as internal. +- Remove `as_user` parameter from `slack.message` payload. + ## v0.107.0 [2021-03-09] ### Features