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 警报的信息,请参阅 手动创建警报。
名称 | 类型 | 描述 |
---|---|---|
node | string | 要与事件关联的 ServiceNow 节点。 |
type | string | ServiceNow 类型,用于标识从中创建警报的事件记录,例如,disk 或 CPU。 |
resource | 将键值对添加到 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 警报或事件字段,如下所示
值 | 字段 |
---|---|
source | 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 }}')
此页面是否对您有帮助?
感谢您的反馈!