pagerduty.severityFromLevel() function

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

*Function type: Transformation*

  1. import "pagerduty"
  2. pagerduty.severityFromLevel(
  3. level: "crit"
  4. )
  5. // Returns "critical"
Status levelPagerDuty severity
critcritical
warnwarning
infoinfo
okinfo

Parameters

level

The InfluxDB status level to convert to a PagerDuty severity.

*Data type: String*

Function definition

  1. import "strings"
  2. severityFromLevel = (level) => {
  3. lvl = strings.toLower(v:level)
  4. sev = if lvl == "warn" then "warning"
  5. else if lvl == "crit" then "critical"
  6. else if lvl == "info" then "info"
  7. else if lvl == "ok" then "info"
  8. else "error"
  9. return sev
  10. }