Documentation

servicenow.endpoint() 函数

servicenow.endpoint() 是一个由 package author 维护的用户贡献函数。

servicenow.endpoint() 将事件发送到 ServiceNow,使用输入行中的数据。

用法

servicenow.endpoint 是一个工厂函数,它输出另一个函数。输出函数需要一个 mapFn 参数。

映射函数

一个构建用于生成ServiceNow API请求的对象的函数。需要一个 r 参数。

mapFn 接受一个表格行 (r) 并返回一个必须包含以下属性的对象:

  • description
  • severity
  • source
  • node
  • metricType
  • resource
  • metricName
  • messageKey
  • additionalInfo

欲了解更多信息,请参阅 servicenow.event() 参数。

函数类型签名
(
    password: string,
    url: string,
    username: string,
    ?source: A,
) => (
    mapFn: (
        r: B,
    ) => {
        C with
        severity: J,
        resource: I,
        node: H,
        metricType: G,
        metricName: F,
        messageKey: E,
        description: D,
    },
) => (<-tables: stream[B]) => stream[{B with _sent: string}] where J: Equatable

有关更多信息,请参见 Function type signatures

参数

网址

(必填) ServiceNow web 服务 URL。

用户名

(必填) 用于HTTP BASIC身份验证的ServiceNow用户名。

密码

(必填) 用于HTTP BASIC身份验证的ServiceNow密码。

来源

源名称。默认是 "Flux"

示例

将关键事件发送到ServiceNow

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

username = secrets.get(key: "SERVICENOW_USERNAME")
password = secrets.get(key: "SERVICENOW_PASSWORD")

endpoint =
    servicenow.endpoint(
        url: "https://example-tenant.service-now.com/api/global/em/jsonv2",
        username: username,
        password: password,
    )

crit_events =
    from(bucket: "example-bucket")
        |> range(start: -1m)
        |> filter(fn: (r) => r._measurement == "statuses" and status == "crit")

crit_events
    |> endpoint(
        mapFn: (r) =>
            ({
                node: r.host,
                metricType: r._measurement,
                resource: r.instance,
                metricName: r._field,
                severity: "critical",
                additionalInfo: {"devId": r.dev_id},
            }),
    )()


Flux的未来

Flux 正在进入维护模式。您可以像现在一样继续使用它,而无需对您的代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现已公开Alpha测试

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

我们将发布两个产品作为测试版的一部分。

InfluxDB 3 核心,是我们新的开源产品。 它是一个用于时间序列和事件数据的实时数据引擎。 InfluxDB 3 企业版是建立在核心基础之上的商业版本,增加了历史查询能力、读取副本、高可用性、可扩展性和细粒度安全性。

有关如何开始的更多信息,请查看: