Webhook icon
Schedule icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon

Collapse Zabbix Problem Storms Into One Incident Page

Correlate Zabbix problem event batches by host group and tag signature, collapse duplicates into incidents, and page Slack on storms.

Categories
Infrastructure

How it works

  1. post_problem_events (io.kestra.plugin.core.trigger.Webhook, keyed with the ZABBIX_EVENTS_WEBHOOK_KEY secret) accepts a problem event batch from a Zabbix media type or reporting sidecar the moment problems open. hourly_event_sweep (io.kestra.plugin.core.trigger.Schedule, cron 0 * * * *) is the safety net and ships disabled: true until an operator turns it on.
  2. group_problem_events (io.kestra.plugin.scripts.python.Script on python:3.12-slim) prefers the posted webhook body and falls back to a bundled example batch so trial runs still demonstrate the correlation. It takes the newest event clock as the reference, drops any event older than window_minutes as stale, then groups the rest under a signature built from the host group, the problem name and the sorted tag pairs. The groups, the scored event count and the stale count are printed as a single ::{"outputs": ...}:: line.
  3. collapse_incidents (io.kestra.plugin.scripts.python.Script) reads those groups, treats one group as one incident, measures the reduction from events to incidents, and grades the storm verdict as a scored batch at or above min_batch_events holding one identical group at or above storm_group_size. An unreadable batch sets collapse_ok false with the grouping problem instead of pretending the estate is calm.
  4. storm_gate (io.kestra.plugin.core.flow.If) branches on a batch that collapsed into a storm. Storms reach notify_dedup_summary (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) with the reduction, the largest group and its signature, so on call gets one page per incident. A quiet batch lands on log_quiet_batch, and an unreadable batch routes through check_batch_health and alert_unreadable_batch.
  5. The flow level errors handler (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) reports any failure with the execution id, because a correlator that dies silently looks exactly like a quiet night.

What you get

  • Duplicate problem events collapsed into incidents by host group, problem name and tag signature inside a configurable window.
  • A storm verdict driven by a batch floor and an identical group size, so a two event blip never pages anyone.
  • A dedup summary that shows the event to incident reduction and names the signature behind the largest group.
  • Fail safe posture, an ungroupable batch pages Slack instead of reading as a calm monitoring estate.
  • events, incidents, storm_detected, largest_incident and storm_signature as typed outputs for incident follow up and alert tuning.

Who it's for

  • NOC and SRE teams tired of identical root cause storms paging on-call dozens of times per outage.
  • Monitoring owners tuning Zabbix trigger and tag hygiene who need evidence of how much duplication a batch carries.
  • Incident commanders who want the dedup ratio attached to the incident record instead of counted by hand.

Why orchestrate this with Kestra

Zabbix fires every problem event independently and leaves correlation to whoever reads the timeline. Kestra gives the media type a keyed webhook, the window and storm policy two typed inputs, a two stage correlator whose rules live in version control, a branch that separates the storm page from the quiet night, and outputs an alert tuning dashboard can consume. A script on the Zabbix server gives you none of that, it has no history, no routing and no gate.

Prerequisites

  • A worker with Docker access, both correlator stages run in python:3.12-slim.
  • A problem event source that POSTs a batch shaped as an events array whose entries carry eventid, clock as a unix timestamp, name, host_group, hosts, severity and a tags array of tag and value pairs, for example the Zabbix problem event API or a media type webhook.
  • A Slack incoming webhook for the dedup summary, the unreadable batch alert and failure alerts.

Secrets

  • ZABBIX_EVENTS_WEBHOOK_KEY: key segment guarding the problem event webhook URL, anyone holding it can trigger a correlation run.
  • SLACK_WEBHOOK_URL: Slack incoming webhook for the dedup summary, the unreadable batch alert and failure alerts.

Quick start

  1. Add the two secrets to your Kestra namespace.
  2. Run the flow once with the default inputs and confirm events reads 12, incidents reads 4, storm_detected reads true, largest_incident reads 6 and storm_signature reads Network|Interface eth0 down|component=net, and that the dedup summary arrived in Slack.
  3. Raise storm_group_size to 7 and re-run to watch storm_detected flip false while the counts stay identical.
  4. Point your Zabbix media type at /api/v1/{tenant}/executions/webhook/{namespace}/zabbix-problem-event-correlation-gate/{ZABBIX_EVENTS_WEBHOOK_KEY} and enable hourly_event_sweep once the path is trusted.

How to extend

  • Add a severity weight to the storm grade so a batch of high severity duplicates pages even when the batch floor is not met.
  • Persist every collapsed batch with io.kestra.plugin.jdbc.postgresql.Queries to chart the dedup ratio per host group over weeks.
  • Deduplicate across batches by keeping the last signature state in the Kestra KV store, so a standing problem does not re-page every sweep.
  • Fan out correlation per host group with io.kestra.plugin.core.flow.ForEachItem over a group list, each subflow collapsing one group of its own.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.