在 Flashduty On-call
您可通过以下两种方式获取集成推送地址,任选其一即可。使用专属集成
- 进入 Flashduty 控制台,选择 协作空间,打开一个协作空间
- 选择 配置 → 集成数据 → 专属集成,点击 新增集成
- 选择 GitGuardian,点击 保存
- 打开生成的集成卡片,复制 推送地址
使用共享集成
- 进入 Flashduty 控制台,选择 集成中心 → 告警事件
- 选择 GitGuardian,填写集成名称
- 配置默认路由并选择协作空间;创建后可在 路由 中增加更多规则
- 点击 保存,复制生成的 推送地址
在 GitGuardian 中配置
需要在 GitGuardian 工作区中有管理集成的权限。1
创建 Custom webhook
操作路径:GitGuardian › Settings › Workspace › Integrations › Destinations › Custom webhook
GitGuardian 会为 webhook 生成一个签名令牌(signature token)。Flashduty 通过推送地址中的
integration_key 鉴权,不校验签名,无需在 Flashduty 中填写该令牌。2
选择事件
操作路径:GitGuardian › Settings › Workspace › Integrations › Destinations › Custom webhook › Events在 Events 页签填写 Events name,打开 Internal monitoring,在 Notify when 下勾选以下事件(也可点击 Select all):
分派、评论、反馈、访问权限、公开分享和 Honeytoken 事件不会改变告警状态,Flashduty 收到后返回成功但不创建告警,无需勾选。如只需要值班处理高风险泄露,可在 webhook 的过滤规则中按严重程度、有效性、密钥类型或标签限制推送范围;未设置规则时,所有 Incident 都会推送。
3
验证生命周期
操作路径:GitGuardian › Settings › Workspace › Integrations › Destinations › Custom webhook在工作区中触发一个新的 Incident,确认 Flashduty 收到活动告警;然后在 GitGuardian 中将该 Incident 标记为 Resolved,确认原告警恢复。在 webhook 所在行的菜单(三个点)中点击 Send test message 只验证地址可达:Flashduty 会返回成功,但不会创建告警。
Alert Key
Flashduty 使用 Incident 的id(Webhook 中的 incident.id)作为 Alert Key。GitGuardian 官方 Webhook 示例中,同一个 Incident 的 New incident、New occurrence、Resolved、Ignored 和 Reopened 事件携带相同的 incident.id。
严重程度、有效性、事件发生次数和检测器名称的变化都不会改变 Alert Key。缺少 incident.id 的 Incident 事件会被拒绝。
状态和告警等级
告警状态由action 决定:incident_resolved 和 incident_ignored 为恢复,上表中其余事件为触发。已解决或已忽略的 Incident 发生有效性、严重程度或风险评分变化时,该事件会被忽略,不会重新打开告警。Incident 被重新打开后会以同一个 Alert Key 触发新的告警。
告警等级由 incident.severity 决定:
unknown 表示 GitGuardian 尚未评级,Flashduty 按 Warning 处理。
标签
排查问题
- 告警没有创建:确认已勾选对应事件,并检查 webhook 的过滤规则是否排除了该 Incident。GitGuardian 说明 webhook 为尽力投递,不保证送达
- 告警没有恢复:确认已在 Incident status change 下勾选 Resolved 和 Ignored
- Flashduty 返回
action is required(400):请求没有action字段,且origin不是 GitGuardian,说明发来的不是 GitGuardian 的 webhook 投递;请确认推送地址只配置在 GitGuardian 的 Custom webhook 上 - Flashduty 返回
incident.id is required(400):事件类型需要 Incident,但请求中没有incident.id - Incident 被忽略后又被重新打开:会以同一个 Alert Key 生成新的告警