/ Integration

Opsgenie Integration

Alert routing and on-call management

Opsgenie Integration

Assert creates an Opsgenie alert when a monitor fails, and your Opsgenie escalation policy decides who it wakes.

The alert carries the assertion that failed, the expected value, the value your API returned, the regions that agreed, and the time. A failure re-runs across regions before the alert is created. Assert creates one alert per incident and closes it when the assertion passes again.

Routing is per monitor, so the payments team and the platform team can own different checks. Opsgenie is on every paid plan.

Setup Guide

Step 1: Create Integration in Opsgenie

  1. Log in to Opsgenie
  2. Go to SettingsIntegration list
  3. Click Add integration
  4. Search for "API" and select the API integration
  5. Copy the API Key

Step 2: Add Opsgenie in Assert

  1. Go to AlertsChannels in your Assert dashboard
  2. Click Add ChannelOpsgenie
  3. Paste your API key
  4. (Optional) Select the team to route alerts to
  5. Click Save

Step 3: Test the Integration

Click Send Test. Assert creates a test alert in Opsgenie. Close the test alert once you see it.

Step 4: Assign to Monitors

Open each monitor. Add the Opsgenie channel under Alert Channels.

How It Works

Alert Creation

When a monitor fails, Assert creates an Opsgenie alert:

{
  "message": "Monitor Failed: Production API",
  "alias": "ApiAssert-mon_abc123",
  "description": "API health check failed",
  "priority": "P1",
  "source": "Assert",
  "tags": ["api", "production", "ApiAssert"],
  "details": {
    "Monitor": "Production API",
    "URL": "https://api.example.com/health",
    "Status Code": "500",
    "Response Time": "2,340ms",
    "Region": "US East",
    "Failure": "$.status expected 'success', got 'error'"
  }
}

Auto-Close

Assert closes the alert with the same alias when the assertion passes again.

Configuration Options

Option Description
API Key Your Opsgenie API integration key
Team Default team to route alerts to
Priority Default priority (P1-P5)
Auto-close Automatically close alerts on recovery

Priority Mapping

Set the priority by monitor type:

Monitor Type Opsgenie Priority
Production APIs P1 (Critical)
Core services P2 (High)
Supporting services P3 (Moderate)
Staging/Dev P4 (Low)

Best Practices

Route to Teams

Create Opsgenie teams for different services:

  • Platform Team for core API monitors
  • Payments Team for payment processing monitors
  • Integrations Team for third-party API monitors

Configure Escalations

Set up escalation policies in Opsgenie:

  1. Immediate: on-call engineer
  2. After 5 min: notify the team channel
  3. After 15 min: escalate to the team lead
  4. After 30 min: escalate to the manager

Use Alert Actions

Opsgenie alert actions worth wiring up:

  • Acknowledge to claim the alert
  • Add Note to record what you found
  • Run Playbook to execute runbook steps
  • Create Jira to track the incident

Set Up Schedules

Create on-call schedules in Opsgenie:

Weekly Rotation:
├── Mon-Wed: Alice
├── Wed-Fri: Bob
└── Fri-Mon: Charlie

Troubleshooting

Alerts not creating?

  • Check the API key
  • Check that the integration is enabled in Opsgenie
  • Check that your Opsgenie plan includes API integrations

Alerts not routing to team?

  • Check that the team name matches exactly
  • Check the team routing rules in Opsgenie
  • Check that the integration can create alerts for the team

Alerts not auto-closing?

  • Check that "Auto-close" is enabled in Assert
  • Check that the alias is set correctly
  • Check that the integration can close alerts

Too many alerts?

  • Turn on alert deduplication in Opsgenie
  • Use the Assert alert cooldown
  • Increase the monitor check interval

Advanced: Alert Policies

Opsgenie alert policies rewrite alerts as they arrive:

  1. Go to SettingsAlert policies
  2. Create a policy that matches the source "Assert"
  3. Set the modifications you want (priority, team, tags)

Example policy:

IF source = "Assert"
AND message contains "staging"
THEN set priority to P4
AND add tag "non-critical"

Integration with Atlassian Suite

Opsgenie connects to the rest of Atlassian:

  • Jira to create tickets from alerts
  • Statuspage to update status when alerts trigger
  • Confluence to link runbooks

Next Steps

Route the alert.

Five monitors, thirty-second checks, no card, no call.