Skip to main 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 alert.highestPriority == "P1" %}
    930aaaaaaaaaaaaaaaaaaaaaaaaaa0d1
    {% elif alert.highestPriority == "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 Add 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:

    • Condition

      alert.highestPriority == "P1"
    • Destination

      • Connector: PagerDuty-Prod
      • Preset: PagerDuty Critical Alert
  6. (Optional) In Fallback, select a connector to receive unmatched alerts.

  7. 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​

Review the permissions required for managing Notification Center in Permissions.

Last updated on