Raising Alerts on consecutive binary state changes

Hi
New to InfluxDB and Kapacitor and looking for direction on how to generate alerts from data stream with structure below.

Note intervals between data points are not fixed.
Need to raise alert for a group (A,B,C etc) if I see 3 consecutive 0s for that group. A single 1 will reset the alert.
HM - HourMinute

Time Group Status
H1M1 A 1
H1M1 B 1
H1M1 C 1
H1M2 A 0
H1M2 B 1
H1M5 A 0
H1M5 C 1
H1M5 B 1
H1M7 A 0 Raise alert on group A
H1M7 B 1
H1M8 C 1
H1M10 A 0 Maintain alert for group A
H1M10 B 1
H1M10 C 1
H1M11 A 1 Reset alert on group A
H1M11 B 1
H1M11 C 1

Appreciate any direction I can get.

1 Like