In MS Teams:
If necessary, create a team and add members
Add a channel to the team where alerts will be sent
Add a "Incoming Webhook" connector to the channel
- Give it a name
- Upload an icon (not critical, but helpful later for quickly telling alerts apart)
- note the WebhookURL
In New Relic:
Goto Alerts | Notification Channels
Add a Webhook channel
- Give it a name
- Set Base URL to MS Teams WebhookURL
- Set custom payload:
{
"account_id": "$ACCOUNT_ID",
"account_name": "$ACCOUNT_NAME",
"closed_violations_count_critical": "$CLOSED_VIOLATIONS_COUNT_CRITICAL",
"closed_violations_count_warning": "$CLOSED_VIOLATIONS_COUNT_WARNING",
"condition_family_id": "$CONDITION_FAMILY_ID",
"condition_name": "$CONDITION_NAME",
"current_state": "$EVENT_STATE",
"details": "$EVENT_DETAILS",
"duration": "$DURATION",
"event_type": "$EVENT_TYPE",
"incident_acknowledge_url": "$INCIDENT_ACKNOWLEDGE_URL",
"incident_id": "$INCIDENT_ID",
"incident_url": "$INCIDENT_URL",
"metadata": "$METADATA",
"open_violations_count_critical": "$OPEN_VIOLATIONS_COUNT_CRITICAL",
"open_violations_count_warning": "$OPEN_VIOLATIONS_COUNT_WARNING",
"owner": "$EVENT_OWNER",
"policy_name": "$POLICY_NAME",
"policy_url": "$POLICY_URL",
"runbook_url": "$RUNBOOK_URL",
"severity": "$SEVERITY",
"targets": "$TARGETS",
"timestamp": "$TIMESTAMP",
"violation_callback_url": "$VIOLATION_CALLBACK_URL",
"violation_chart_url": "$VIOLATION_CHART_URL",
"title": "$CONDITION_NAME",
"text": "$EVENT_DETAILS"
}
Notes:
"title" and "text" are the important fields here, and are not provided in the template payload.
"text" can accept multiple parameters, literal strings and newlines - e.g. "text": "Hello World\n\r$EVENT_DETAILS\n\r$EVENT_STATE"
- Test webhook
Add the Notification Channel to one or more alert policies
No comments:
Post a Comment