Webhook icon
Script icon
Docker icon
If icon
PagerDutyAlert icon
SlackIncomingWebhook icon
Log icon
OutputValues icon

Event-Driven Incident Auto-Triage with PagerDuty and SRE Diagnostics

Triage monitoring alerts automatically with Python-based SRE diagnostics and route critical incidents to PagerDuty and Slack war rooms.

Categories
Infrastructure

Production incidents demand immediate diagnostics, but waking up engineers for transient glitches or misdiagnosing saturated connection pools drives alert fatigue. This blueprint implements an event-driven incident auto-triage workflow that intercepts alerts via Webhook, executes containerized diagnostic runbooks with Python, and conditionally escalates confirmed critical outages to PagerDuty and Slack while suppressing false alarms.

How it works

  1. Webhook Ingestion: The webhook_alert trigger (io.kestra.plugin.core.trigger.Webhook) accepts real-time incident payloads from monitoring stacks (Prometheus Alertmanager, Datadog, Grafana, AWS CloudWatch).
  2. Automated Diagnostics: The automated_diagnostics task (io.kestra.plugin.scripts.python.Script inside Docker) inspects raw error logs and stack traces against heuristic SRE runbook patterns (database connection starvation, OOM kills, unclassified errors), extracting actionable mitigation actions and an escalation recommendation.
  3. Conditional Severity Gate: The evaluate_severity_and_escalate flowable task (io.kestra.plugin.core.flow.If) evaluates whether the diagnosis requires human intervention:
    • Escalate: If critical or confirmed by diagnostics, creates a PagerDuty incident via trigger_pagerduty_incident (io.kestra.plugin.pagerduty.PagerDutyAlert) using Events API v2 with automatic deduplication, then dispatches an incident briefing card to Slack via dispatch_slack_war_room (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).
    • Suppress & Log: If non-critical, logs routine findings via log_routine_notice (io.kestra.plugin.core.log.Log) without waking on-call personnel.
  4. Telemetry Export: The finalize_incident_audit_record task (io.kestra.plugin.core.output.OutputValues) publishes structured triage findings for post-mortem analysis and SLA reporting.
  5. Pipeline Resilience: An errors handler (on_pipeline_failure_fallback) ensures that if the triage pipeline itself fails, an emergency PagerDuty alert is dispatched to safeguard observability reliability.

What you get

  • Automated first-line log inspection before waking on-call engineers.
  • Deterministic deduplication across PagerDuty incidents using composite execution keys.
  • Clean separation between noisy transient warnings and high-priority outages.
  • Fallback error handler ensuring triage pipeline health is monitored.

Who it's for

  • Site Reliability Engineers (SREs) and DevOps teams managing 24/7 on-call rotations.
  • Platform teams seeking to reduce on-call alert fatigue and lower Mean Time to Acknowledge (MTTA).
  • Engineering organizations integrating monitoring alerts with PagerDuty and Slack war rooms.

Why orchestrate this with Kestra

Kestra coordinates webhook ingestion, isolated Docker runtime environments for Python diagnostics, conditional routing logic, and multi-channel alerting into a single auditable execution graph. If a downstream notification fails or logs are malformed, Kestra's execution history provides full replayability and audit traces without maintaining dedicated triage servers.

Prerequisites

  • A PagerDuty technical service with an Events API v2 integration key.
  • A Slack Incoming Webhook URL for the SRE incident channel.
  • Docker or container runtime enabled on Kestra workers for Python script execution.

Secrets

  • PAGERDUTY_ROUTING_KEY: 32-character PagerDuty Integration Key for the Events API v2 endpoint.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for incident notification broadcasting.

Quick start

  1. Configure the PAGERDUTY_ROUTING_KEY and SLACK_WEBHOOK_URL in your Kestra namespace secrets.
  2. Import this flow YAML into your Kestra workspace under namespace company.sre.
  3. Execute the flow manually with test log payloads to verify diagnostic outputs and alerting logic.
  4. Configure your monitoring webhook (Alertmanager or Datadog) to post incident payloads to Kestra's webhook trigger endpoint.

How to extend

  • Connect vector search or LLM enrichment to query internal post-mortem repositories for past incident resolutions.
  • Automatically generate an incident channel in Slack using the Slack API plugin.
  • Add automated remediation actions (e.g. restart Kubernetes pods or trigger rollbacks) inside the then branch.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.