Webhook 触发器
Webhook 触发器会监控集群资源使用指标,并在达到配置阈值时发送 HTTP 通知。该功能仅属于企业版,并且只有在部署 dashboard 版本 v0.2.0-alpha.10 或更高版本的企业版 dashboard 时可用。
在 dashboard apiserver 配置中,按 provisioned instance 将 webhook 触发器配置到 settings.monitoring.webhook_triggers 下。启用 webhook 触发器需要配置指标数据源,即 settings.monitoring.greptimedb.url 或 settings.monitoring.metrics.prometheus。
provisionedInstances:
- name: mycluster
settings:
monitoring:
greptimedb:
url: http://monitoring-greptimedb:4000
# 也可以使用 Prometheus 兼容的指标数据源:
# metrics:
# prometheus: http://prometheus:9090
webhook_triggers:
- name: high-datanode-memory
enabled: true
roles: [datanode]
metric: memory_usage_percent
operator: ">="
threshold: 90
cooldown_seconds: 300
url: https://alerts.example.com/datanode-memory
headers:
Authorization: Bearer token
- name: high-frontend-cpu
enabled: true
roles: [frontend]
metric: cpu_usage_millicores
threshold: 1000
cooldown_seconds: 600
url: https://alerts.example.com/frontend-cpu
Webhook 触发器配置项:
name:触发器名称。enabled为true时必填。同一个 instance 内名称必须唯一,且不能包含/。enabled:启用或禁用该触发器。roles:可选的角色过滤器。省略或留空表示匹配所有角色。支持的角色包括frontend、metasrv、datanode和flownode。metric:要检查的资源使用指标。支持memory_usage_percent、memory_usage_bytes、cpu_usage_percent和cpu_usage_millicores。operator:比较运算符。默认值和当前唯一支持的值都是>=。threshold:阈值,必须大于0。百分比指标的阈值必须小于或等于100。cooldown_seconds:同一活跃告警重复发送firing通知的最小间隔,默认值为300秒。url:Webhook 端点。enabled为true时必填,并且必须使用http://或https://