Skip to content

Route P1 alerts to PagerDuty

This example shows how to send P1 alerts to a PagerDuty service using Notification Center.
You configure a PagerDuty connector, create a preset, define a router and routing rule, and label alerts for correct delivery.

Workflow overview

  1. Create a PagerDuty connector: connects Coralogix to a PagerDuty service
  2. Create a preset: defines the PagerDuty event payload
  3. Create a router and routing rule: sends only P1 alerts to PagerDuty
  4. Label alerts: ensures alerts match the router

Create a PagerDuty connector

  1. Go to Integrations, then Notification Center, then Connectors.
  2. Select + New connector.
  3. Choose PagerDuty as the destination type.
  4. In Details, enter a name and optional description.
    Example: PagerDuty-Prod.
  5. In Configuration:
    • Service key: Enter your PagerDuty integration key.
      See PagerDuty guide for instructions.
  6. (Optional) Select Advanced, then Dynamic fields, define a dynamic service key to route alerts to different PagerDuty services.

    Example:

    {% if alertDef.priority == "P1" %}
    930aaaaaaaaaaaaaaaaaaaaaaaaaa0d1
    {% elif alertDef.priority == "P2" %}
    930bbbbbbbbbbbbbbbbbbbbbbbbbb0d1
    {% else %}
    930xxxxxxxxxxxxxxxxxxxxxxxxxx0d1
    {% endif %}
    
  7. Select Send test notification.

  8. Select Create connector.

Create a preset (optional)

If you do not need a custom message format, skip this section and use the system preset.

  1. Go to Integrations, then Notification Center, then Presets.
  2. Open the Alerts tab and select PagerDuty.
  3. Select + New alert preset.
  4. Customize the Triggered template fields:

    FieldExample template
    Summary{{ alertDef.name }} - Triggered
    Severity"critical"
    Source{{ _context.system.name }}
    Timestamp{{ alert.timestamp }}
    Custom details{ "description": {{ alertDef.description | json_encode }} }
  5. Use the Preview panel to review output.

  6. (Optional) Use Send test notification to validate with your PagerDuty connector.
  7. Select Create preset.

Create a router and routing rule

  1. Go to Integrations, then Notification Center, then Routers.
  2. Select + New router.
  3. In Details, enter a router name such as Critical Alerts.
  4. In Routing labels, add labels that this router matches:

    group:sre
    environment:prod
    
    5. Add a routing rule:

  5. Condition

    alertDef.priority == "P1"
    

  6. Destination

    • Connector: PagerDuty-Prod
    • Preset: PagerDuty Critical Alert
  7. (Optional) In Fallback, select a connector to receive unmatched alerts.
  8. Select Create router.

Label alerts

  1. Go to Alerts, then Create alert.
  2. In Labels, add routing labels matching your router:

    routing.team:sre
    routing.environment:prod
    
  3. Set the alert priority to P1.

  4. Save the alert.

When triggered, the alert is routed through the Critical Alerts router and sent to PagerDuty.

Example result

A triggered alert produces a PagerDuty event like:

Summary: CPU Usage High - Triggered

Severity: critical

Source: prod-cluster-01

Custom details: CPU utilization exceeded 95% on host server-1.

Next steps

Was this helpful?