Flux 0.84 (#1432)
* added flux 0.84 release notes * Flux Opsgenie package (#1431) * added the flux Opsgenie package * minor update to opsgenie pkg descriptionpull/1446/head
parent
97d1bc1aad
commit
1a3ce7095d
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: Flux Opsgenie package
|
||||
list_title: Opsgenie package
|
||||
description: >
|
||||
The Flux Opsgenie package provides functions that send alerts to
|
||||
[Atlassian Opsgenie](https://www.atlassian.com/software/opsgenie) using the
|
||||
[Opsgenie v2 API](https://docs.opsgenie.com/docs/alert-api#create-alert).
|
||||
Import the `contrib/sranka/opsgenie` package.
|
||||
menu:
|
||||
influxdb_2_0_ref:
|
||||
name: Opsgenie
|
||||
parent: Contributed
|
||||
weight: 202
|
||||
influxdb/v2.0/tags: [functions, opsgenie, package]
|
||||
---
|
||||
|
||||
The Flux Opsgenie package provides functions that send alerts to
|
||||
[Atlassian Opsgenie](https://www.atlassian.com/software/opsgenie) using the
|
||||
[Opsgenie v2 API](https://docs.opsgenie.com/docs/alert-api#create-alert).
|
||||
Import the `contrib/sranka/opsgenie` package:
|
||||
|
||||
```js
|
||||
import "contrib/sranka/opsgenie"
|
||||
```
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
||||
|
||||
{{% note %}}
|
||||
#### Package author and maintainer
|
||||
**Github:** [@sranka](https://github.com/sranka)
|
||||
**InfluxDB Slack:** [@sranka](https://influxdata.com/slack)
|
||||
{{% /note %}}
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
title: opsgenie.endpoint() function
|
||||
description: >
|
||||
The `opsgenie.endpoint()` function sends an alert message to Opsgenie using data from table rows.
|
||||
menu:
|
||||
influxdb_2_0_ref:
|
||||
name: opsgenie.endpoint
|
||||
parent: Opsgenie
|
||||
weight: 202
|
||||
---
|
||||
|
||||
The `opsgenie.endpoint()` function sends an alert message to Opsgenie using data from table rows.
|
||||
|
||||
_**Function type:** Output_
|
||||
|
||||
```js
|
||||
import "contrib/sranka/opsgenie"
|
||||
|
||||
opsgenie.endpoint(
|
||||
url: "https://api.opsgenie.com/v2/alerts",
|
||||
apiKey: "YoUrSup3R5ecR37AuThK3y",
|
||||
entity: "example-entity"
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### url
|
||||
Opsgenie API URL.
|
||||
Defaults to `https://api.opsgenie.com/v2/alerts`.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### apiKey
|
||||
<span class="req">Required</span>
|
||||
Opsgenie API authorization key.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### entity
|
||||
Alert entity used to specify the alert domain.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Usage
|
||||
`opsgenie.endpoint` is a factory function that outputs another function.
|
||||
The output function requires a `mapFn` parameter.
|
||||
|
||||
### mapFn
|
||||
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:
|
||||
|
||||
- `message`
|
||||
- `alias`
|
||||
- `description`
|
||||
- `priority`
|
||||
- `responders`
|
||||
- `tags`
|
||||
- `actions`
|
||||
- `details`
|
||||
- `visibleTo`
|
||||
|
||||
_For more information, see [`opsgenie.sendAlert()`](/influxdb/v2.0/reference/flux/stdlib/contrib/opsgenie/sendalert/)._
|
||||
|
||||
## Examples
|
||||
|
||||
##### Send critical statuses to Opsgenie
|
||||
```js
|
||||
import "influxdata/influxdb/secrets"
|
||||
import "contrib/sranka/opsgenie"
|
||||
|
||||
apiKey = secrets.get(key: "OPSGENIE_APIKEY")
|
||||
endpoint = opsgenie.endpoint(apiKey: apiKey)
|
||||
|
||||
crit_statuses = from(bucket: "example-bucket")
|
||||
|> range(start: -1m)
|
||||
|> filter(fn: (r) => r._measurement == "statuses" and status == "crit")
|
||||
|
||||
crit_statuses
|
||||
|> endpoint(mapFn: (r) => ({
|
||||
message: "Great Scott!- Disk usage is: ${r.status}.",
|
||||
alias: "disk-usage-${r.status}",
|
||||
description: "",
|
||||
priority: "P3",
|
||||
responders: ["user:john@example.com", "team:itcrowd"],
|
||||
tags: [],
|
||||
entity: "my-lab",
|
||||
actions: [],
|
||||
details: "{}",
|
||||
visibleTo: []
|
||||
})
|
||||
)()
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Package author and maintainer
|
||||
**Github:** [@sranka](https://github.com/sranka)
|
||||
**InfluxDB Slack:** [@sranka](https://influxdata.com/slack)
|
||||
{{% /note %}}
|
|
@ -0,0 +1,142 @@
|
|||
---
|
||||
title: opsgenie.sendAlert() function
|
||||
description: >
|
||||
The `opsgenie.sendAlert()` function sends an alert message to Opsgenie.
|
||||
menu:
|
||||
influxdb_2_0_ref:
|
||||
name: opsgenie.sendAlert
|
||||
parent: Opsgenie
|
||||
weight: 202
|
||||
---
|
||||
|
||||
The `opsgenie.sendAlert()` function sends an alert message to Opsgenie.
|
||||
|
||||
_**Function type:** Output_
|
||||
|
||||
```js
|
||||
import "contrib/sranka/opsgenie"
|
||||
|
||||
opsgenie.sendAlert(
|
||||
url: "https://api.opsgenie.com/v2/alerts",
|
||||
apiKey: "YoUrSup3R5ecR37AuThK3y",
|
||||
message: "Example message",
|
||||
alias: "Example alias",
|
||||
description: "Example description",
|
||||
priority: "P3",
|
||||
responders: ["user:john@example.com", "team:itcrowd"],
|
||||
tags: ["tag1", "tag2"],
|
||||
entity: "example-entity",
|
||||
actions: ["action1", "action2"],
|
||||
details: "{}",
|
||||
visibleTo: []
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### url
|
||||
Opsgenie API URL.
|
||||
Defaults to `https://api.opsgenie.com/v2/alerts`.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### apiKey
|
||||
<span class="req">Required</span>
|
||||
Opsgenie API authorization key.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### message
|
||||
<span class="req">Required</span>
|
||||
Alert message text.
|
||||
130 characters or less.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### alias
|
||||
Opsgenie alias usee to de-deduplicate alerts.
|
||||
250 characters or less.
|
||||
Defaults to [message](#message).
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### description
|
||||
Alert description.
|
||||
15000 characters or less.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### priority
|
||||
Opsgenie [alert priority](https://docs.opsgenie.com/docs/alert-priority-settings).
|
||||
Valid values include:
|
||||
|
||||
- `P1`
|
||||
- `P2`
|
||||
- `P3` _(default)_
|
||||
- `P4`
|
||||
- `P5`
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### responders
|
||||
List of responder teams or users.
|
||||
Use the `user:` prefix for users and `teams:` prefix for teams.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
### tags
|
||||
Alert tags.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
### entity
|
||||
Alert entity used to specify the alert domain.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### actions
|
||||
List of actions available for the alert.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
### details
|
||||
Additional alert details.
|
||||
Must be a JSON-encoded map of key-value string pairs.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### visibleTo
|
||||
List of teams and users the alert will be visible to without sending notifications.
|
||||
Use the `user:` prefix for users and `teams:` prefix for teams.
|
||||
|
||||
_**Data type:** Array of strings_
|
||||
|
||||
## Examples
|
||||
|
||||
##### Send the last reported status to a Opsgenie
|
||||
```js
|
||||
import "influxdata/influxdb/secrets"
|
||||
import "contrib/sranka/opsgenie"
|
||||
|
||||
apiKey = secrets.get(key: "OPSGENIE_APIKEY")
|
||||
|
||||
lastReported =
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: -1m)
|
||||
|> filter(fn: (r) => r._measurement == "statuses")
|
||||
|> last()
|
||||
|> findRecord(fn: (key) => true, idx: 0)
|
||||
|
||||
opsgenie.sendAlert(
|
||||
apiKey: apiKey,
|
||||
message: "Disk usage is: ${lastReported.status}.",
|
||||
alias: "example-disk-usage",
|
||||
responders: ["user:john@example.com", "team:itcrowd"]
|
||||
)
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Package author and maintainer
|
||||
**Github:** [@sranka](https://github.com/sranka)
|
||||
**InfluxDB Slack:** [@sranka](https://influxdata.com/slack)
|
||||
{{% /note %}}
|
|
@ -14,6 +14,22 @@ Though newer versions of Flux may be available, they will not be included with
|
|||
InfluxDB until the next InfluxDB v2.0 release._
|
||||
{{% /note %}}
|
||||
|
||||
## v0.84.0 [2020-09-09]
|
||||
|
||||
### Breaking changes
|
||||
- Remove time-column parameters from `range()` function and update type signature.
|
||||
|
||||
### Features
|
||||
- Add [Opsgenie package](/influxdb/v2.0/reference/flux/stdlib/contrib/opsgenie/).
|
||||
- Implement [`lastSuccess()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-tasks/lastsuccess/) in the `tasks` package.
|
||||
- Support duration values in `aggregateWindow`.
|
||||
- Update Apache Arrow to 1.0.1.
|
||||
|
||||
### Bug fixes
|
||||
- Ensure meta columns are never part of group key.
|
||||
|
||||
---
|
||||
|
||||
## v0.83.1 [2020-09-02]
|
||||
|
||||
### Bug fixes
|
||||
|
|
Loading…
Reference in New Issue