在 Flashduty On-call
您可通过以下两种方式获取集成推送地址,任选其一即可。使用专属集成
- 进入 Flashduty 控制台,选择 协作空间,打开一个协作空间
- 选择 配置 → 集成数据 → 专属集成,点击 新增集成
- 选择 Logz.io,点击 保存
- 打开生成的集成卡片,复制 推送地址
使用共享集成
- 进入 Flashduty 控制台,选择 集成中心 → 告警事件
- 选择 Logz.io,填写集成名称
- 配置默认路由并选择协作空间;创建后可在 路由 中增加更多规则
- 点击 保存,复制生成的 推送地址
在 Logz.io 中配置
1
在 Logz.io 中创建 Custom Endpoint
操作路径:Logz.io › Settings › Notification endpoints › Add endpoint点击 Run the test 测试端点连通性。测试请求中
alert_definition_id 为空(alert_severity 为 Medium),Flashduty 会返回 HTTP 400 alert_definition_id is required,Logz.io 侧显示为测试失败。这是预期行为:不会创建告警,仍可点击 Add a new endpoint 保存端点,也不影响真实告警。2
在 Logz.io 告警中选择该端点
操作路径:Logz.io › Alerts › Log Alert › Notifications › Notification endpoints编辑或创建一条 Log Alert,在 Notifications → Notification endpoints 中勾选刚创建的 Custom Endpoint。
3
在 Flashduty 协作空间开启超时自动关闭
操作路径:Flashduty 控制台 › 协作空间 › 配置 › 设置 › 高级配置Logz.io 的 Custom Endpoint 没有恢复事件,也没有可配置的恢复模板:告警条件恢复正常后不会再收到任何通知,对应的 Flashduty 告警会一直处于触发状态。
若告警条件在这段时间内仍未消失,Logz.io 会在下一次评估周期重新发送通知,重新触发一条新告警。
4
让告警真实触发并确认
操作路径:Logz.io › Settings › Notification endpoints(Run the test 在端点表单中)Run the test 只能检查连通性,不会生成告警(见第一步)。请让告警条件真实满足一次,确认 Flashduty 收到对应告警,集成显示 最新事件时间。
Alert Key
Flashduty 使用alert_definition_id 作为 Alert Key。Logz.io 官方文档把它定义为”Unique alert ID”(告警定义的唯一 ID),与之相对的 alert_event_id 是”Unique ID of the triggered alert instance”(每次触发实例的唯一 ID,每次通知都不同)。因此同一个告警定义反复触发(包括等待期结束后的重复通知、跨严重度阈值的升级通知)会落在同一条 Flashduty 告警上,而不同的告警定义各自独立。
Logz.io 的 Custom Endpoint 变量中不包含分组(Group By)字段的取值:如果告警配置了按字段分组(例如按 host 分组),不同分组各自触发的通知会共用同一个 alert_definition_id,从而合并到同一条 Flashduty 告警上。如需区分分组,请为每个分组单独创建一条告警定义(各自拥有独立的 alert_definition_id),或改用一个能区分分组的下游系统。
标题、描述、严重度、时间范围的变化都不会改变 Alert Key;请求缺少 alert_definition_id 时,Flashduty 会拒绝该请求。
状态和告警等级
alert_severity 对应 Logz.io 告警配置中的 Severity Threshold(severityThresholdTiers),取值不区分大小写。空值或未列出的取值会被拒绝。由于 Custom Endpoint 没有恢复事件,告警状态始终等于上表中的等级,不会出现”恢复”状态。
告警内容
- 标题:
alert_title;为空时使用Logz.io alert - 描述:
alert_description - 标签:
check(标题)、source(固定为logz_io)、alert_definition_id、alert_event_id、account_id、account_name、alert_tags、alert_timeframe_start、alert_timeframe_end、alert_app_url、vendor_severity(原始alert_severity取值)
排查问题
- Flashduty 返回参数错误:确认消息体是合法 JSON,且
alert_definition_id、alert_severity非空;确认 Headers 中已添加Content-Type: application/json - 真实告警没有收到(测试按钮显示失败属预期):确认告警的 Notification endpoints 中勾选了该 Custom Endpoint,且告警条件确实被触发
- 告警一直不消失:Logz.io 没有恢复通知,需要开启协作空间的超时自动关闭,或在 Flashduty 中手动关闭
- 多个分组的告警互相合并:Logz.io 的 Custom Endpoint 模板不暴露分组字段,需要为每个分组单独创建告警定义