BigPanda 事件处理程序
BigPanda 是一个事件关联和自动化平台,可帮助组织预防和解决 IT 停机事件。
配置
BigPanda 事件处理程序的配置和默认 选项 值在您的 kapacitor.conf 中设置。下面的示例显示了默认配置
[bigpanda]
enabled = false
# BigPanda integration App Key
app-key = ""
# Authorization Bearer token for BigPanda REST API.
token = ""
# BigPanda Alert API url
url = "https://api.bigpanda.io/data/v2/alerts" enabled
设置为 true 以启用 BigPanda 事件处理程序。
token
设置您的 BigPanda REST API 的授权 Bearer 令牌。
app-key
设置您的 BigPanda 集成 App Key。要获取您的 App Key,请登录您的 BigPanda 帐户,然后在标题工具栏中选择 **Integrations**,然后单击 **New Integration**。选择 **Alerts REST API**,单击 **Integrate** 按钮,然后单击 **Create an App Key**。
url
BigPanda Alert API URL。
选项
以下 BigPanda 事件处理程序选项可以在 handler 文件中设置,或者在 TICKscript 中使用 .bigPanda() 时设置。
| 名称 | 类型 | 描述 |
|---|---|---|
| appKey | string | BigPanda appKey |
| primaryProperty | string | BigPanda primary property |
| secondaryProperty | string | BigPanda secondary property |
| host | string | Host alert payload parameter (object that caused the alert) |
| attributes | map of key value pairs | Option to add additional attribute(s) to the alert payload |
BigPanda 使用 primary property 来构造 incident 的标题,并使用 secondary property 来构造副标题。有关更多信息,请参阅 Alert Correlation Logic。
默认情况下,该处理程序将 Kapacitor 任务和警报属性映射到 BigPanda Alert 或 Event 字段,如下所示:
| Value | BigPanda Alert Field |
|---|---|
id | check |
message | description |
details | details |
TaskName | task |
所有 EventData 标签和字段都将作为 **Additional attributes** 附加到 BigPanda Alert。有关更多信息,请参阅 BigPanda Alert REST API。
TICKscript 示例
stream
|from()
.measurement('cpu')
|alert()
.id('cpu_usage')
.crit(lambda: "usage_user" > 90)
.stateChangesOnly()
.message('Hey, check your CPU')
.bigPanda()stream
|from()
.database('telegraf')
.retentionPolicy('autogen')
.measurement('cpu')
.groupBy('host')
.where(lambda: "cpu" == 'cpu-total')
|eval(lambda: 100.0 - "usage_idle").as('total_used')
|window().period(10s).every(10s)
|mean('total_used').as('total_used')
|alert()
.id('cpu_usage_check')
.message('Hey {{ index .Tags "host"}} / {{ .ID }}: is high!')
.details('https://example.com/dashboard/{{ index .Tags "host"}}')
.info(lambda: "total_used" > 70)
.warn(lambda: "total_used" > 80)
.crit(lambda: "total_used" > 90)
.stateChangesOnly()
.appKey('...')
bigPanda()
.host('{{ .Tags.host }}')
.attribute('monitor_link', 'http://example.com/monitor?node={{ .Tags.host }}')
.attribute('x_total_used', '{{ .Fields.total_used }}')此页面是否有帮助?
感谢您的反馈!
支持和反馈
感谢您成为我们社区的一员!我们欢迎并鼓励您对 Kapacitor 和本文档提供反馈和错误报告。要获取支持,请使用以下资源: