Opsgenie Integration

Alert API v2 integration with automatic alert lifecycle management, responder routing, and multi-region support.

Integration Details

Uptime Monitor uses Opsgenie Alert API v2 with the following behavior:

  • Alert alias format: {monitor_id}-{incident_id} for deduplication
  • Source field: uptime-monitor
  • User field: uptime-monitor-system
  • Default tags: uptime-monitor, {monitor_type}
  • Actions included: "View Dashboard", "Check Logs"
  • Entity field: monitor name

API Configuration

Required API Permissions

Your API key (GenieKey) must have these permissions:

  • • Create alerts
  • • Close alerts
  • • Update alerts

US Instance

Base URL: https://api.opsgenie.com

EU Instance

Base URL: https://api.eu.opsgenie.com

Configuration Fields

API Key (Required)

Your Opsgenie GenieKey for authentication.

Priority (Optional)

Default priority for all alerts from this contact:

  • • P1 - Critical
  • • P2 - High
  • • P3 - Moderate
  • • P4 - Low
  • • P5 - Informational

Certificate expiration alerts default to P2 if not specified.

Responders (Optional)

Currently supports configuration via API. Frontend support coming soon. Responder types:

  • • team
  • • user
  • • escalation
  • • schedule

Tags (Optional)

Comma-separated custom tags. These are added in addition to the default tags.

Auto-Close Alerts (Default: Enabled)

When enabled, alerts are automatically closed via /v2/alerts/{alias}/close when monitors recover. Close note includes recovery duration.

EU Instance (Default: Disabled)

Routes requests to api.eu.opsgenie.com instead of api.opsgenie.com.

Alert Payload Structure

Monitor down alerts include:

{
  "message": "{monitor.name} is DOWN",
  "alias": "{monitor.id}-{incident.id}",
  "description": "Monitor is not responding. Reason: {incident.reason}",
  "priority": "P2",  // If configured
  "source": "uptime-monitor",
  "entity": "{monitor.name}",
  "user": "uptime-monitor-system",
  "note": "Alert created by uptime-monitor.io",
  "tags": ["uptime-monitor", "{monitor_type}", ...custom_tags],
  "actions": ["View Dashboard", "Check Logs"],
  "details": {
    "monitor_id": "{monitor.id}",
    "monitor_name": "{monitor.name}",
    "monitor_url": "{monitor.settings}",  // Full URL/endpoint
    "monitor_type": "HTTPS|TCP|Ping",
    "monitor_dashboard": "https://{env.website_url}/monitors/{monitor.id}",
    "incident_id": "{incident.id}",
    "region": "{first_failed_region}",
    "error_message": "{incident.reason}",
    "check_interval": {monitor.check_interval},
    "timeout": {monitor.timeout}
  },
  "responders": [...]  // If configured
}

The details field contains custom properties accessible in Opsgenie for filtering, reporting, and automation.

Certificate Expiration Alerts

Certificate alerts use a different structure:

{
  "message": "{period.message(host)}",  // e.g., "Certificate for example.com expires in 7 days"
  "alias": "cert-{monitor.id}-{days_until_expiry}",
  "description": "SSL certificate for {host} will expire in {days} days. Please renew it to avoid service disruption.",
  "priority": "P2",  // Default if not configured
  "tags": ["uptime-monitor", "cert-expiry", ...custom_tags],
  "entity": "{host}",
  "actions": ["Renew Certificate"],
  "details": {
    "monitor_id": "{monitor.id}",
    "host": "{host}",
    "port": {port},
    "days_until_expiry": {days},
    "cert_expires_at": "{timestamp}",
    "certificate_type": "ssl"
  }
}

Alert Closure

When auto-close is enabled and a monitor recovers:

POST /v2/alerts/{alias}/close?identifierType=alias

{
  "user": "uptime-monitor-system",
  "source": "uptime-monitor",
  "note": "Monitor {monitor.name} recovered after {duration} downtime"
}

Duration is formatted as human-readable text (e.g., "2 hours 15 minutes").

Known Limitations

Current Limitations

  • Responder configuration is not yet available in the UI (API only)
  • visibleTo field is not implemented
  • Free plan limited to 1 Opsgenie contact
  • No support for custom alert actions beyond defaults

API Error Codes

401 Unauthorized

Invalid API key or insufficient permissions. Verify GenieKey has alert create/close/update permissions.

422 Unprocessable Entity

Usually indicates invalid responder configuration. Check responder names/IDs exist in your Opsgenie account.

404 Not Found (on close)

Alert with given alias doesn't exist or was already closed. This is logged but not treated as an error.

429 Too Many Requests

Opsgenie rate limit exceeded. Alerts will be retried automatically.