8 minute read
Trustgrid can be integrated with Incident.io using the generic webhook channel to send alerts based on Trustgrid events. This allows for streamlined incident management and improved response times. The guide below outlines the steps to set up this integration along with suggestions on gathering additional attributes for the alerts.
On Call
, click on Alerts
.+
to the right of Sources
to create a new source.
http
.Type of HTTP Source
select custom. This allows the source to use the native Trustgrid JSON payload which can be transformed into the Incident.io format.Query Authentication
tab.Transform Expression
and Deduplication key path
Transform expression
section. There will be existing JavaScript there. Select all and delete.Transform expression
section:var resolvedFlag = !!$.resolved; // force boolean
var statusValue = resolvedFlag ? "resolved" : "firing";
return {
title: $.nodeName + " - " + $.eventType,
description: $.message,
status: statusValue,
deduplication_key: $.uid,
metadata: {
nodeName: $.nodeName,
eventType: $.eventType,
level: $.level,
domain: $.domain,
tags: $.tags,
timestamp: $.timestamp
}
};
Deduplication key path
section and set the value to $.uid
.No alerts received yet
. In the next section, you will create a Webhook channel in Trustgrid and trigger events to generate sample Alerts for Incident.io to use to complete the configuration.To complete the below step it is idea to identify a node that you can use to generate test events, ideally by performing an action such as restarting the node. In the example below we will create a new Alarm Filter for a specific node and test by restarting it.
+Create Channel
button. (Or optionally select and choose Edit from Actions to add to an existing Channel)+Create Alarm
button.INFO
so that all relevant events match the filter including Resolved
notifications.Node Restart
event, then a Node Disconnect
event followed by a Node Connect
event.The Trustgrid system will only send out matching alerts if there are no unresolved events of that type. If the test node has unresolved events, use the Alert Center to clear the:
To complete the configuration we will use the generated Alerts to extract additional useful attributes from the example events to surface in Incident.io. Feel free to modify the Attribute names to fit your needs.
Configure your setup
page, you can map the attributes from the incoming alerts to the fields in Incident.io. Use the example alert to help you identify the relevant fields.Alert title
and Description
mappings unless you need to customize them.Attributes
.
Alert Payload
section, click +“nodeName”. As the name implies, this will include the name of the Node the event relates to.
Server Name
, you can create a new one. Scroll down and select + Add new attribute
.
Node Name
. Leave all other settings at their defaults.Choose what results should be parsed into
to Labels
.
1 var resolvedFlag = !!$.resolved; // force boolean
2 var statusValue = resolvedFlag ? "resolved" : "firing";
3
4 return {
5 title: $.nodeName + " - " + $.eventType,
6 description: $.message,
7 status: statusValue,
8 deduplication_key: $.uid,
9 metadata: {
10 nodeName: $.nodeName,
11 eventType: $.eventType,
12 level: $.level,
13 domain: $.domain,
14 tags: $.tags,
15 timestamp: $.timestamp
16 }
17 };
firing
for new alerts and resolved
for resolved alerts.firing
or resolved
.firing
alert with its corresponding resolved
alert.If you want to test the webhook integration, you can use Curl to send a sample payload to the Incident.io webhook URL.
This can be useful if you are not seeing the expected alerts in Incident.io after triggering events in the Trustgrid portal as the curl command may return any HTTP error Incident.io is responding with.
Here’s an example command:
curl -X POST <WEBHOOK_URL> \
-H "Content-Type: application/json" \
-d '{
"nodeName": "edge1",
"expires": 1604801325,
"level": "INFO",
"eventType": "Test Event",
"source": "EKG",
"message": "This is just a test event. It is not real.",
"type": "Alert",
"orgId": "8e1c2c05-2c86-4b1b-a0cc-############",
"GS1PK": "Org#8e1c2c05-2c86-4b1b-a0cc-############",
"_ct": {},
"uid": "1jwV1R2R6itQUjPza9yqTE8a8zu",
"GS1SK": "Alert#1jwV1R2R6itQUjPza9yqTE8a8zu",
"_md": {},
"domain": "example.trustgrid.io",
"SK": "Alert#Node Disconnect",
"_tp": "Alert",
"PK": "Node#0895b104-5434-447b-8577-############",
"state": "UNKNOWN",
"nodeId": "0895b104-5434-447b-8577-############",
"timestamp": 1604714923,
"channelID": "bc47ca84-1d04-454b-bedc-a55d1a917c0e",
"notes": ["Text from Description Field"],
"tags": { "prod_status":"production","site_name":"Main Datacenter"},
"resolved": false
}
Replace <WEBHOOK_URL>
with the actual URL of your Incident.io webhook. This command will simulate an alert being sent to Incident.io, allowing you to verify that the integration is working correctly.
If everything is working you should see a message like {"status":"accepted","message":"Event accepted for processing","deduplication_key":"735cbacc3f07e740d26ff364a19f856aa5af95f929017538214093afb132006e"}
and then the Alert will show in Incident.io.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.