home / skills / openclaw / skills / pagerduty

pagerduty skill

/skills/mrgoodb/pagerduty

This skill helps you manage PagerDuty incidents, on-call schedules, and alerts programmatically, triggering and resolving events via API integration.

npx playbooks add skill openclaw/skills --skill pagerduty

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.6 KB
---
name: pagerduty
description: Manage incidents, on-call schedules, and alerts via PagerDuty API. Trigger and resolve incidents programmatically.
metadata: {"clawdbot":{"emoji":"🚨","requires":{"env":["PAGERDUTY_API_KEY"]}}}
---

# PagerDuty

Incident management.

## Environment

```bash
export PAGERDUTY_API_KEY="u+xxxxxxxxxx"
export PAGERDUTY_SERVICE_ID="PXXXXXX"
export PAGERDUTY_ROUTING_KEY="xxxxxxxxxx"  # For Events API
```

## Trigger Incident (Events API v2)

```bash
curl -X POST "https://events.pagerduty.com/v2/enqueue" \
  -H "Content-Type: application/json" \
  -d '{
    "routing_key": "'$PAGERDUTY_ROUTING_KEY'",
    "event_action": "trigger",
    "dedup_key": "incident-123",
    "payload": {
      "summary": "Server CPU at 95%",
      "severity": "critical",
      "source": "monitoring-system"
    }
  }'
```

## Resolve Incident

```bash
curl -X POST "https://events.pagerduty.com/v2/enqueue" \
  -H "Content-Type: application/json" \
  -d '{
    "routing_key": "'$PAGERDUTY_ROUTING_KEY'",
    "event_action": "resolve",
    "dedup_key": "incident-123"
  }'
```

## List Incidents

```bash
curl "https://api.pagerduty.com/incidents?statuses[]=triggered&statuses[]=acknowledged" \
  -H "Authorization: Token token=$PAGERDUTY_API_KEY"
```

## Get On-Call

```bash
curl "https://api.pagerduty.com/oncalls" \
  -H "Authorization: Token token=$PAGERDUTY_API_KEY"
```

## List Services

```bash
curl "https://api.pagerduty.com/services" \
  -H "Authorization: Token token=$PAGERDUTY_API_KEY"
```

## Links
- Dashboard: https://app.pagerduty.com
- Docs: https://developer.pagerduty.com

Overview

This skill lets you manage incidents, alerts, and on-call data in PagerDuty using the PagerDuty API. It supports triggering and resolving incidents via the Events API, listing active incidents, querying on-call schedules, and enumerating services. Use environment variables for API credentials and routing/service identifiers.

How this skill works

The skill sends HTTP requests to PagerDuty endpoints: the Events API v2 for trigger/resolve actions and the REST API for incidents, on-calls, and services. It reads API keys and routing/service IDs from environment variables and constructs JSON payloads for alerts and control actions. Responses are parsed to return incident IDs, status, and relevant metadata.

When to use it

  • Automatically trigger alerts from monitoring systems when thresholds are breached.
  • Programmatically resolve incidents once automated remediation completes.
  • Fetch currently triggered or acknowledged incidents for dashboards or reports.
  • Query on-call rotations to determine who should be notified.
  • List services to map alerts to the correct PagerDuty service.

Best practices

  • Store PAGERDUTY_API_KEY and routing/service IDs as secure environment variables, not in code.
  • Use dedup_key with the Events API to correlate trigger/resolve pairs for the same incident.
  • Set meaningful payload.summary and severity values to help responders triage quickly.
  • Rate-limit requests and handle HTTP errors and retries according to PagerDuty docs.
  • Validate API responses and log incidents IDs and statuses for auditing.

Example use cases

  • A monitoring job posts a 'critical' event to trigger an incident when CPU usage spikes above 90%.
  • A deployment pipeline resolves related incidents after a rollback completes and services return to normal.
  • An operations dashboard lists all triggered and acknowledged incidents for the last 24 hours.
  • A chatops command queries the on-call schedule to route a support request to the correct engineer.
  • An automation script enumerates services to verify correct routing keys before sending events.

FAQ

What environment variables are required?

Set PAGERDUTY_API_KEY for REST API calls and PAGERDUTY_ROUTING_KEY for the Events API. Optionally set PAGERDUTY_SERVICE_ID when targeting a specific service.

How do I correlate a trigger and its resolution?

Include a consistent dedup_key in both trigger and resolve events so PagerDuty links them as the same incident.