Documentation

servicenow.event() function

servicenow.event() is a user-contributed function maintained by the package author.

servicenow.event() sends an event to ServiceNow.

ServiceNow Event API fields are described in ServiceNow Create Event documentation.

Function type signature
(
    description: A,
    password: string,
    severity: B,
    url: string,
    username: string,
    ?additionalInfo: C,
    ?messageKey: D,
    ?metricName: E,
    ?metricType: F,
    ?node: G,
    ?resource: H,
    ?source: I,
) => int where B: Equatable, C: Equatable
For more information, see Function type signatures.

Parameters

url

(Required) ServiceNow web service URL.

username

(Required) ServiceNow username to use for HTTP BASIC authentication.

password

(Required) ServiceNow password to use for HTTP BASIC authentication.

description

(Required) Event description.

severity

(Required) Severity of the event.

Supported values:

  • critical
  • major
  • minor
  • warning
  • info
  • clear

source

Source name. Default is "Flux".

node

Node name or IP address related to the event. Default is an empty string ("").

metricType

Metric type related to the event (for example, CPU). Default is an empty string ("").

resource

Resource related to the event (for example, CPU-1). Default is an empty string ("").

metricName

Metric name related to the event (for example, usage_idle). Default is an empty string ("").

messageKey

Unique identifier of the event (for example, the InfluxDB alert ID). Default is an empty string (""). If an empty string, ServiceNow generates a value.

additionalInfo

Additional information to include with the event.

Examples

Send the last reported value and incident type to ServiceNow

import "contrib/bonitoo-io/servicenow"
import "influxdata/influxdb/secrets"

username = secrets.get(key: "SERVICENOW_USERNAME")
password = secrets.get(key: "SERVICENOW_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)

servicenow.event(
    url: "https://tenant.service-now.com/api/global/em/jsonv2",
    username: username,
    password: password,
    node: lastReported.host,
    metricType: lastReported._measurement,
    resource: lastReported.instance,
    metricName: lastReported._field,
    severity:
        if lastReported._value < 1.0 then
            "critical"
        else if lastReported._value < 5.0 then
            "warning"
        else
            "info",
    additionalInfo: {"devId": r.dev_id},
)

Was this page helpful?

Thank you for your feedback!


Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.