ServiceNow 事件处理器
ServiceNow 提供服务管理软件,包含一个全面的托管工作流,支持实时通信、协作和资源共享等功能。配置 Kapacitor 以将警报消息发送到 ServiceNow。
配置
ServiceNow 事件处理器的配置和默认 选项 值在您的 kapacitor.conf 文件中设置。示例如下显示了默认配置
[servicenow]
# Configure ServiceNow.
enabled = false
# The ServiceNow URL for the target table (Alert or Event). Replace this instance with your hostname.
url = "https://instance.service-now.com/api/global/em/jsonv2"
# Default source identification.
source = "Kapacitor"
# Username for HTTP BASIC authentication
username = ""
# Password for HTTP BASIC authentication
password = ""enabled
设置为 true 以启用 ServiceNow 事件处理器。
url
ServiceNow 实例地址。
source
默认“Kapacitor”源。
username
用于基本 HTTP 身份验证的用户名。
password
用于基本 HTTP 身份验证的密码。
选项
以下 ServiceNow 事件处理器选项可以在 处理程序文件 中设置,或者在 TICKscript 中使用 .serviceNow() 时设置。这些选项会设置 ServiceNow 警报或事件中的相应字段。有关 ServiceNow 警报的信息,请参阅 手动创建警报。
| 名称 | 类型 | 描述 |
|---|---|---|
| 节点 | string | 与事件关联的 ServiceNow 节点。 |
| type | string | 用于标识创建警报的事件记录的 ServiceNow 类型,例如 disk 或 CPU。 |
| 资源 | 向 Sensu API 请求添加键值对。 | |
| metricName | string | 唯一名称,用于描述为已创建警报而收集的指标。 |
| messageKey | string | 用于标识与同一警报相关的多个事件的唯一事件标识符。如果为空,则由 source、node、type、resource 和 metricName 字段值生成。 |
| source | string | 生成事件的源。 |
| message | string | 警报消息。 |
| alert ID | string | 用于标识警报的唯一 ID。 |
以上所有处理程序选项都支持使用以下变量的模板: ID、Name、TaskName、Fields、Tags,与 AlertNode.message 中的变量相同。
默认情况下,处理程序将下面的 Kapacitor 值映射到 ServiceNow 警报或事件字段,如下所示:
| Value | 字段 |
|---|---|
| source | 来源 |
| message | 描述 |
| alert ID | 消息键 |
TICKscript 示例
stream
|from()
.measurement('cpu')
|alert()
.crit(lambda: "usage_user" > 90)
.stateChangesOnly()
.message('Hey, check your CPU')
.serviceNow()stream
|from()
.measurement('cpu')
|alert()
.crit(lambda: "usage_user" > 90)
.message('Hey, check your CPU')
.serviceNow()
.node('{{ index .Tags "host" }}')
.type('CPU')
.resource('CPU-Total')
.metricName('usage_user')
.messageKey('Alert: {{ .ID }}')此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Kapacitor 和本文档提供反馈和错误报告。要获取支持,请使用以下资源: