pagerduty.severityFromLevel() function

Flux 0.43.0+

The pagerduty.severityFromLevel() function converts an InfluxDB status level to a PagerDuty severity.

import "pagerduty"

  level: "crit"

// Returns "critical"
Status level PagerDuty severity
crit critical
warn warning
info info
ok info



The InfluxDB status level to convert to a PagerDuty severity.

Function definition

import "strings"

severityFromLevel = (level) => {
  lvl = strings.toLower(v:level)
  sev = if lvl == "warn" then "warning"
      else if lvl == "crit" then "critical"
      else if lvl == "info" then "info"
      else if lvl == "ok" then "info"
      else "error"
  return sev

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.