← Blog
Tutorial 8 min read

How to Connect PingBase to PagerDuty

PingBase detects downtime. PagerDuty manages on-call escalation. Together they cover the full incident response chain: detection → alert → escalate → notify the right person. Here's the setup.

PagerDuty doesn't do its own monitoring — it receives alerts from monitoring tools and routes them through on-call schedules, escalation policies, and notification rules. PingBase is the monitoring layer; PagerDuty is the escalation layer. The integration uses PingBase's webhook alert channel to send events to PagerDuty's Events API v2.


What you'll need


Step 1: Get your PagerDuty integration key

  1. In PagerDuty, go to Services → Service Directory and select the service you want alerts routed to (or create a new one)
  2. Click Integrations → Add an integration
  3. Select Events API v2 and click Add
  4. Copy the Integration Key — you'll need it in the next step

The Events API v2 endpoint is https://events.pagerduty.com/v2/enqueue. PagerDuty expects a JSON payload in a specific format, which is what the middleware script below produces.


Step 2: Deploy a webhook translator

PingBase sends a standard JSON webhook payload when a monitor goes down or recovers. PagerDuty expects its own Events API v2 format. You need a small translation layer between them.

The easiest approach: a Cloudflare Worker (free) or any serverless function that receives the PingBase webhook and re-sends it to PagerDuty in the right format.

# Cloudflare Worker — PingBase → PagerDuty translator

export default {
  async fetch(request, env) {
    if (request.method !== 'POST') {
      return new Response('Method not allowed', { status: 405 });
    }

    const body = await request.json();
    const { event, monitor } = body;

    // Map PingBase events to PagerDuty event actions
    const action = event === 'monitor.down' ? 'trigger'
                 : event === 'monitor.up'   ? 'resolve'
                 : null;

    if (!action) return new Response('Ignored', { status: 200 });

    const pdPayload = {
      routing_key: env.PD_INTEGRATION_KEY,
      event_action: action,
      dedup_key: monitor.id, // ensures down/up pair correctly
      payload: {
        summary: `${monitor.name} is ${action === 'trigger' ? 'DOWN' : 'UP'}`,
        source: monitor.url,
        severity: 'critical',
        custom_details: {
          monitor_id: monitor.id,
          monitor_url: monitor.url,
          group: monitor.group ?? null,
        },
      },
    };

    const res = await fetch('https://events.pagerduty.com/v2/enqueue', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(pdPayload),
    });

    return new Response(await res.text(), { status: res.status });
  }
};

Deploy this Worker and set the PD_INTEGRATION_KEY environment variable to the integration key from Step 1. The Worker's URL will be something like https://pingbase-pd.yourworker.workers.dev.


Step 3: Add a webhook alert channel in PingBase

  1. In PingBase, go to Alert Channels → Add channel → Webhook
  2. Enter the URL of your translator Worker
  3. Click Test to send a test payload and confirm it reaches PagerDuty
  4. Save the channel

You can now add this webhook channel to individual monitors. When a monitor goes down, PingBase sends the webhook, the Worker translates it, and PagerDuty triggers an incident — routing through your on-call schedule and escalation policy.


Step 4: Configure PagerDuty escalation policy

In PagerDuty, your escalation policy determines who gets notified and when. For a typical small engineering team:

The dedup key in the Worker payload (monitor.id) ensures PagerDuty automatically resolves the incident when PingBase sends the recovery event — no manual resolution needed.


Which monitors to route to PagerDuty

Not every monitor needs PagerDuty escalation. Route to PagerDuty only the monitors where an incident at 3am requires someone to wake up and fix it immediately:

For lower-urgency monitors (marketing site, docs, SSL expiry), use Slack or email instead. PagerDuty escalation for a blog going down at 2am is alert fatigue, not incident response.


PingBase vs PagerDuty's native monitoring

PagerDuty offers its own synthetic monitoring product. For teams already on PagerDuty, the question is whether to use PagerDuty's monitoring or a dedicated tool like PingBase.

PagerDuty's monitoring starts at $17/monitor/month. PingBase Pro covers 10 monitors for $9/month total. For teams that need PagerDuty's escalation and on-call features but want cost-effective monitoring, the PingBase + PagerDuty webhook integration gives you both without paying PagerDuty's per-monitor pricing.

Monitor with PingBase, escalate with PagerDuty

PingBase's webhook alert channel connects to PagerDuty, OpsGenie, or any on-call system. Pro plan starts at $9/month for 10 monitors.

Start free →

Related