天天看點

group_wait、group_interval、repeat_interval對告警的影響官方解釋實驗結論參考

目錄

  • 官方解釋
    • group_wait(default: 30s)
    • group_interval(default: 5m)
    • repeat_interval(default: 4h)
  • 實驗
    • 參數
    • 告警過程
  • 結論
  • 參考

官方解釋

group_wait(default: 30s)

How long to initially wait to send a notification for a group of alerts. Allows to wait for an inhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)

一組告警第一次發送之前等待的時間。用于等待抑制告警,或等待同一組告警采集更多初始告警後一起發送。(一般設定為0秒 ~ 幾分鐘)

group_interval(default: 5m)

How long to wait before sending a notification about new alerts that are added to a group of alerts for which an initial notification has already been sent. (Usually ~5m or more.)

一組已發送初始通知的告警接收到新告警後,再次發送通知前等待的時間(一般設定為5分鐘或更多)

repeat_interval(default: 4h)

How long to wait before sending a notification again if it has already been sent successfully for an alert. (Usually ~3h or more).

一條成功發送的告警,在再次發送通知之前等待的時間。 (通常設定為3小時或更長時間)。

實驗

參數

group_wait: 10s
group_interval: 30m
repeat_interval: 50m
           

告警過程

  1. alertmanager收到告警後,等待group_wait(10s),發送第一次通知
  2. 未達到group_interval(30m 10s),休眠
  3. 達到group_interval(30m 10s)時,小于repeat_interval(50m 10s),休眠
  4. 到下一個group_interval(60m 10s),大于repeat_interval(50m 10s),發送第二次通知

Firing(0s) - 第一次通知(10s) - 第二次通知(60m 10s)

結論

  1. 當repeat_interval小于group_interval時,repeat_interval不影響告警
  2. 當repeat_interval大于group_interval,且不為group_interval倍數,影響告警
  3. 當repeat_interval大于group_interval,且為group_interval倍數,可能影響告警(*注)

注:

當repeat_interval大于group_interval,且為group_interval倍數時,可能發生兩種情況:

  1. 在repeat_interval時發出告警
  2. 在repeat_interval + group_interval時發出告警(原因是如果repeat_interval是group_interval的倍數,則在需要發出通知時會同時判斷兩個值,程式耗時 + 網絡耗時會導緻對比結果不準确)

參考

  1. 關于 Alertmanager 中 group_interval 與 repeat_interval 上的一些坑
  2. issue:Some troubles about group_interval, group_wait and repeat_interval