|
| 1 | +New Relic Integration with Robusta |
| 2 | +================================== |
| 3 | + |
| 4 | +.. note:: |
| 5 | + This feature is available with the Robusta SaaS platform and self-hosted commercial plans. It is not available in the open-source version. |
| 6 | + |
| 7 | +This guide explains how to route New Relic alerts to Robusta's UI via a webhook. |
| 8 | + |
| 9 | +Requirements |
| 10 | +------------ |
| 11 | + |
| 12 | +- Robusta must already be deployed and running in your environment. |
| 13 | +- You have admin access to the Robusta UI (to create API keys and view your ``account_id``). |
| 14 | +- You have admin access to New Relic Alerts (to create Destinations and Workflows). |
| 15 | + |
| 16 | +Integration Steps |
| 17 | +----------------- |
| 18 | + |
| 19 | +We will configure: |
| 20 | + |
| 21 | +1. A Robusta API key and account ID. |
| 22 | +2. A New Relic **Webhook Destination** pointing to Robusta. |
| 23 | +3. A New Relic **Workflow** that always sends notifications to Robusta using a custom payload template. |
| 24 | + |
| 25 | +Step 1: Get Account ID and API Key |
| 26 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 27 | + |
| 28 | +Obtain your Robusta ``account_id`` and create an API key: |
| 29 | + |
| 30 | +1. In the Robusta UI, navigate to **Settings → API Keys**. |
| 31 | +2. Click **New API Key**. |
| 32 | +3. Name the key **New Relic**, grant it **Read/Write** access to alerts, and click **Generate API Key**. |
| 33 | +4. Copy and securely store the generated API key — you’ll use it as a **Bearer token** in New Relic. |
| 34 | +5. In **Settings → Workspace**, copy your **account_id**. |
| 35 | + |
| 36 | +Step 2: Create a Webhook Destination in New Relic |
| 37 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 38 | + |
| 39 | +In New Relic: |
| 40 | + |
| 41 | +1. Go to **Alerts → Destinations**. |
| 42 | +2. Click **New destination** → choose **Webhook**. |
| 43 | +3. Configure: |
| 44 | + |
| 45 | + - **URL**: ``https://api.robusta.dev/integrations/generic/newrelic`` |
| 46 | + - **Authentication**: **Bearer token** |
| 47 | + - **Token**: paste the **Robusta API key** from Step 1. |
| 48 | + |
| 49 | +4. Save the destination. (Optional) Use **Send test notification** to verify connectivity. |
| 50 | + |
| 51 | +Step 3: Configure a Workflow to Send Alerts |
| 52 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 53 | + |
| 54 | +1. Go to **Alerts → Workflows**. |
| 55 | +2. Use an existing workflow or click **New workflow**. |
| 56 | +3. **When**: set to **Always send notifications** (or choose your preferred filter). |
| 57 | +4. **Then**: add an **Action → Webhook** and select the **Robusta** destination created in Step 2. |
| 58 | +5. **Template**: choose **Custom payload** and paste the JSON template below. |
| 59 | +6. Replace ``ACCOUNT_ID_HERE`` with your **account_id** from Step 1. |
| 60 | +7. Save and enable the workflow. |
| 61 | + |
| 62 | +Webhook Payload Template (JSON) |
| 63 | +------------------------------- |
| 64 | + |
| 65 | +Paste this into the **Template** field for the webhook action. Replace ``ACCOUNT_ID_HERE`` with your actual account ID. |
| 66 | + |
| 67 | +.. code-block:: json |
| 68 | +
|
| 69 | + { |
| 70 | + "account_id": "ACCOUNT_ID_HERE", |
| 71 | + "title": {{#if annotations}}{{#if annotations.title}}{{ json annotations.title.[0] }}{{else}}"N/A"{{/if}}{{else}}"N/A"{{/if}}, |
| 72 | + "description": {{#if annotations}}{{#if annotations.description}}{{ json annotations.description.[0] }}{{else}}{{#if annotations.title}}{{ json annotations.title.[0] }}{{else}}"N/A"{{/if}}{{/if}}{{else}}"N/A"{{/if}}, |
| 73 | + "source": "newrelic", |
| 74 | + "priority": {{#if priority}}{{ json priority }}{{else if severity}}{{ json severity }}{{else}}null{{/if}}, |
| 75 | + "aggregation_key": {{#if accumulations.conditionName}}{{ json accumulations.conditionName.[0] }}{{else}}null{{/if}}, |
| 76 | + "starts_at": {{#if createdAt}}{{#timezone createdAt 'UTC'}}{{/timezone}}{{else}}"2025-09-22 00:00:00 UTC"{{/if}}, |
| 77 | + "ends_at": {{#eq state "CLOSED"}}{{#if updatedAt}}{{#timezone updatedAt 'UTC'}}{{/timezone}}{{else}}null{{/if}}{{else}}null{{/eq}}, |
| 78 | + "cluster": {{#if [latest clusterName]}} |
| 79 | + {{ json [latest clusterName] }} |
| 80 | + {{else if accumulations}} |
| 81 | + {{#if accumulations.tag}} |
| 82 | + {{#if accumulations.tag.k8s.clusterName}} |
| 83 | + {{ json accumulations.tag.k8s.clusterName.[0] }} |
| 84 | + {{else if accumulations.tag.cluster}} |
| 85 | + {{ json accumulations.tag.cluster.[0] }} |
| 86 | + {{else if tag.k8s.clusterName}} |
| 87 | + {{ json tag.k8s.clusterName.[0] }} |
| 88 | + {{else}} |
| 89 | + "external" |
| 90 | + {{/if}} |
| 91 | + {{else}} |
| 92 | + "external" |
| 93 | + {{/if}} |
| 94 | + {{else}} |
| 95 | + "external" |
| 96 | + {{/if}}, |
| 97 | + "raw_alert_data": {{ json . }} |
| 98 | + } |
| 99 | +
|
| 100 | +Optional: Field Mapping Notes |
| 101 | +----------------------------- |
| 102 | + |
| 103 | +- ``title`` / ``description`` are sourced from ``annotations`` when present, otherwise fall back to ``"N/A"``. |
| 104 | +- ``priority`` prefers ``priority`` and falls back to ``severity`` when available. |
| 105 | +- ``aggregation_key`` maps to the Alert name to help group similar alerts in Robusta. |
| 106 | +- ``starts_at`` / ``ends_at`` are normalized to **UTC** by New Relic templating. |
| 107 | +- ``cluster`` attempts multiple common locations for Kubernetes cluster identifiers and defaults to ``"external"``. |
| 108 | +- ``raw_alert_data`` includes the full New Relic payload for troubleshooting in Robusta. |
| 109 | + |
| 110 | +Validation |
| 111 | +---------- |
| 112 | + |
| 113 | +- Trigger a test alert that matches the workflow (or use **Send test notification** on the Destination). |
| 114 | +- In Robusta's UI, verify the alert appears with the expected title, description, priority, and cluster. |
0 commit comments