New Relic

Steps to configure New Relic integration for incident management, using Squadcast

New Relic is an observability platform built to help engineers create more perfect software. From monoliths to serverless, you can instrument everything, then analyze, troubleshoot, and optimize your entire software stack, all from one place.

Route detailed monitoring alerts from New Relic to the right users in Squadcast.

How to integrate New Relic with Squadcast

In Squadcast: Using New Relic as an Alert Source

  1. Navigate to Services -> Service Overview -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click Add.

2. Select New Relic. Copy the displayed Webhook URL to configure it within New Relic. Finish by clicking Add Alert Source -> Done.

Important:

When an alert source turns Active, it’ll show up under Configured Alert Sources, you can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source. An Alert Source is active if there is a recorded incident via that Alert Source for the Service.

In New Relic: Add a Squadcast Webhook

Log in to your New Relic account.

(1) From Explorer dashboard, click on Alerts & AI. Then naviagte to Workflows and click on + Add a workflow

(2) Fill in the Name, select Issues according to your own preference. Under Mute issues, choose Always send notifications and click on Webhook

(3) Put in the webhook channel's name and click on + Add a destination

(4) Now, you can add a Webhook name, paste the previously copied Squadcast Webhook URL in the placeholder for Endpoint URL and save it.

(5) Select the previously created Squadcast Webhook as Destination and paste the payload mentioned below under the Payload template. Then click on Update message

{
    "id": {{ json issueId }},
    "issueUrl": {{ json issuePageUrl }},
    "title": {{ json annotations.title.[0] }},
    "priority": {{ json priority }},
    "impactedEntities": {{json entitiesData.names}},
    "totalIncidents": {{json totalIncidents}},
    "state": {{ json state }},
    "trigger": {{ json triggerEvent }},
    "isCorrelated": {{ json isCorrelated }},
    "createdAt": {{ createdAt }},
    "updatedAt": {{ updatedAt }},
    "sources": {{ json accumulations.source }},
    "alertPolicyNames": {{ json accumulations.policyName }},
    "alertConditionNames": {{ json accumulations.conditionName }},
    "workflowName": {{ json workflowName }},
    "status" : {{ json status }},
    "annotationsDescription":{{json annotations.description.[0]}}
}

You can also send test notifications to Squadcast through Send test notification

Note

Add Additional Incident Information

You can even send additional information for an incident.

Users can define additional variables along with the default variables to receive more detailed information about an Incident under the Payload template. You can copy the template mentioned below instead of the template mentioned above for Step (5)

{
	"id": {{ json issueId }},
	"issueUrl": {{ json issuePageUrl }},
	"title": {{ json annotations.title.[0] }},
	"priority": {{ json priority }},
	"impactedEntities": {{json entitiesData.names}},
	"totalIncidents": {{json totalIncidents}},
	"state": {{ json state }},
	"trigger": {{ json triggerEvent }},
	"isCorrelated": {{ json isCorrelated }},
	"createdAt": {{ createdAt }},
	"updatedAt": {{ updatedAt }},
	"sources": {{ json accumulations.source }},
	"alertPolicyNames": {{ json accumulations.policyName }},
	"alertConditionNames": {{ json accumulations.conditionName }},
	"workflowName": {{ json workflowName }},
    "status" : {{ json status }},
    "annotationsDescription":{{json annotations.description.[0]}},
    "showAdditionalData":"true",
    "additionalData":{
    {{#if nrAccountId}}"account_id": {{nrAccountId}},{{/if}}
    "account_name": {{json accumulations.tag.account.[0]}},
    "closed_violations_count": {
        "critical": {{#if closedIncidentsCount}}{{closedIncidentsCount}}{{else}}0{{/if}},
        "warning": 0,
        "total": {{#if closedIncidentsCount}}{{closedIncidentsCount}}{{else}}0{{/if}}
    },
    "condition_family_id": {{accumulations.conditionFamilyId.[0]}},
    "condition_id": {{accumulations.conditionFamilyId.[0]}},
    "condition_name": {{json accumulations.conditionName.[0]}},
    "current_state": {{#if issueClosedAt}}"closed"{{else if issueAcknowledgedAt}}"acknowledged"{{else}}"open"{{/if}},
    "details": {{json issueTitle}},
    "duration": {{#if issueDurationMs}}{{issueDurationMs}}{{else}}0{{/if}},
    "event_type": "INCIDENT",
    "incident_acknowledge_url": {{json issueAckUrl}},
    "incident_url": {{json issuePageUrl}},
    "issue_id": {{json issueId}},
    "metadata": {
        {{#if locationStatusesObject}}"location_statuses": {{json locationStatusesObject}},{{/if}}
        {{#if accumulations.metadata_entity_type}}"entity.type": {{json accumulations.metadata_entity_type.[0]}},{{/if}}
        {{#if accumulations.metadata_entity_name}}"entity.name": {{json accumulations.metadata_entity_name.[0]}}{{/if}}
    },
    "open_violations_count": {
        "critical": {{#if openIncidentsCount}}{{openIncidentsCount}}{{else}}0{{/if}},
        "warning": 0,
        "total": {{#if openIncidentsCount}}{{openIncidentsCount}}{{else}}0{{/if}}
    },
    "policy_name": {{json accumulations.policyName.[0]}},
    "radar_entity": {
        {{#if accumulations.tag.accountId}}"accountId": {{json accumulations.tag.accountId.[0]}},{{/if}}
        "domain": {{json accumulations.conditionProduct.[0]}},
        "domainId": {{json issueId}},
        "entityGuid": {{json entitiesData.entities.[0].id}},
        "name": {{#if accumulations.targetName}}{{json accumulations.targetName.[0]}}{{else if entitiesData.entities}}{{json entitiesData.entities.[0].name}}{{else}}"NA"{{/if}},
        "type": {{#if entitiesData.types.[0]}}{{json entitiesData.types.[0]}}{{else}}"NA"{{/if}}
    },
    "severity": "{{#eq 'HIGH' priority}}WARNING{{else}}{{priority}}{{/eq}}",
    "state": {{json state}},
    "status": {{json status}},
    "targets": [
        {
            "id": {{#if entitiesData.entities.[0].id}}{{json entitiesData.entities.[0].id}}{{else if accumulations.nrqlEventType}}{{json accumulations.nrqlEventType.[0]}}{{else}}"N/A"{{/if}},
            "name": {{#if accumulations.targetName}}{{json accumulations.targetName.[0]}}{{else if entitiesData.entities}}{{json entitiesData.entities.[0].name}}{{else}}"NA"{{/if}},
            "link": {{json issuePageUrl}},
            "product": {{json accumulations.conditionProduct.[0]}}
        }
    ],
        "timestamp": {{updatedAt}},
    "timestamp_utc_string": {{json issueUpdatedAt}},
    "version": "1.0",
    "VIOLATION DESCRIPTION": {{json accumulations.conditionDescription.[0]}},
    "violation_callback_url": {{json issuePageUrl}}
    {{#if accumulations.tag.action}},"action":{{json accumulations.tag.action.[0]}}{{/if}}
    {{#if accumulations.evaluationName}},"condition_metric_name": {{json accumulations.evaluationName.[0]}}{{/if}}
    {{#if accumulations.evaluationMetricValueFunction}},"condition_metric_value_function": {{json accumulations.evaluationMetricValueFunction.[0]}}{{/if}}
    {{#if labels.nrIncidentId}},"incident_id": {{labels.nrIncidentId.[0]}}{{/if}}
    {{#if owner}},"owner": {{json owner}}{{/if}}
    {{#if policyUrl}},"policy_url": {{json policyUrl}}{{/if}}
    {{#if accumulations.runbookUrl}},"runbook_url": {{json accumulations.runbookUrl.[0]}}{{/if}}
    }
}

(6) Finally click on Activate workflow. You can even test the workflow by clicking on Test workflow

That's it, you are good to go! Your New Relic integration is now complete.

Whenever New Relic fires an alert, an incident will be created in Squadcast for it. Also, when an alert is resolved in New Relic, the corresponding incident gets auto-resolved in Squadcast.

Have any questions? Ask the community.

Last updated