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
- :coralogix-actions-connect-medium: Create a PagerDuty connector: connects Coralogix to a PagerDuty service
- :coralogix-actions-edit-medium: Create a preset: defines the PagerDuty event payload
- :coralogix-actions-filter-medium: Create a router and routing rule: sends only P1 alerts to PagerDuty
- :coralogix-general-alerts-medium-stroke: Label alerts: ensures alerts match the router
Create a PagerDuty connector
-
Go to Integrations, then Notification Center, then Connectors.
-
Select + New connector.
-
Choose PagerDuty as the destination type.
-
In Details, enter a name and optional description.
Example:PagerDuty-Prod. -
In Configuration:
- Service key: Enter your PagerDuty integration key.
See PagerDuty guide for instructions.
- Service key: Enter your PagerDuty integration key.
-
(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 %} -
Select Send test notification.
-
Select Create connector.
Create a preset (optional)
If you do not need a custom message format, skip this section and use the system preset.
-
Go to Integrations, then Notification Center, then Presets.
-
Open the Alerts tab and select PagerDuty.
-
Select + New alert preset.
-
Customize the Triggered template fields:
Field Example template Summary {{ alertDef.name }} - TriggeredSeverity "critical"Source {{ _context.system.name }}Timestamp {{ alert.timestamp }}Custom details { "description": {{ alertDef.description | json_encode }} } -
Use the Preview panel to review output.
-
(Optional) Use Send test notification to validate with your PagerDuty connector.
-
Select Create preset.
Create a router and routing rule
-
Go to Integrations, then Notification Center, then Routers.
-
Select + New router.
-
In Details, enter a router name such as
Critical Alerts. -
In Routing labels, add labels that this router matches:
group:sreenvironment:prod -
Add a routing rule:
-
Condition
alert.highestPriority == "P1" -
Destination
- Connector:
PagerDuty-Prod - Preset:
PagerDuty Critical Alert
- Connector:
-
-
(Optional) In Fallback, select a connector to receive unmatched alerts.
-
Select Create router.
Label alerts
-
Go to Alerts, then Create alert.
-
In Labels, add routing labels matching your router:
routing.team:srerouting.environment:prod -
Set the alert priority to
P1. -
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.