opsgenie.sendAlert() function
The opsgenie.sendAlert()
function sends an alert message to Opsgenie.
*Function type: Output*
Opsgenie API URL. Defaults to https://api.opsgenie.com/v2/alerts
.
*Data type: String*
apiKey
Required Opsgenie API authorization key.
*Data type: String*
message
Required Alert message text. 130 characters or less.
*Data type: String*
alias
*Data type: String*
Alert description. 15000 characters or less.
*Data type: String*
priority
Opsgenie alert priority. 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.
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 prefix for users and teams:
prefix for teams.
*Data type: Array of strings*
Examples
Send the last reported status to a Opsgenie
import "influxdata/influxdb/secrets"
import "contrib/sranka/opsgenie"
apiKey = secrets.get(key: "OPSGENIE_APIKEY")
lastReported =
from(bucket: "example-bucket")
|> range(start: -1m)
|> 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"]