• Products
  • Get started
  • Documentation
  • Resources

Integrate Opsgenie with Microsoft Azure Event Hubs

Azure Event Hubs logo

Overview

For an alert rule on a metric value, when the value of a specified metric crosses a threshold assigned, the alert rule becomes active and sends a notification. For an alert rule on events, a rule can send a notification on every event or only when a certain number of events happen.

What does the integration offer?

Azure Event Hubs can generate alerts based on metrics. Opsgenie acts as a dispatcher for the alerts generated by Azure. Opsgenie determines the right people to notify based on on-call schedules and escalations and notifies via email, text messages (SMS), phone calls, and Android & iOS push notifications.

Opsgenie supports the new Azure metrics alerts as well. With the Azure new metric alerts, new fields are added to the new Azure payload. Hence, you can accordingly configure the integration to support them. Learn more about supported resources for metric alerts in Azure Monitor.​

Set up the integration

Azure Event Hubs is an API-based integration. Setting it up involves the following steps:

  • Add an Azure Event Hubs integration in Opsgenie

  • Configure the integration in Azure Event Hubs

Add an Azure Event Hubs integration

If you're using Opsgenie's Free or Essentials plan or if you’re using Opsgenie with Jira Service Management's Standard plan, you can add this integration from your team dashboard only. The Integrations page under Settings is not available in your plan.

  1. Go to Teams and select your team.

  2. Select Integrations on the left navigation and then select Add integration.

Adding the integration from your team dashboard will make your team the owner of the integration. This means Opsgenie will assign the alerts received through this integration to your team only. Follow the rest of the steps in this section to set up the integration.

To add an Azure Event Hubs integration in Opsgenie:

  1. Go to Settings > Integrations.

  2. Select Add integration.

  3. Run a search and select “Azure Event Hubs”.

  4. On the next screen, enter a name for the integration.

  5. Optional: Select a team in Assignee team if you want a specific team to receive alerts from the integration.

  6. Select Continue.
    The integration is saved at this point.

  7. Expand the Steps to configure the integration section and copy the integration URL generated for your account.
    You will use this URL while configuring the integration in Azure later.

  8. Select Turn on integration.
    The rules you create for the integration will work only if you turn on the integration.

Configure the integration in Azure

1. In the Azure Portal, go to the Events Hubs page.

2. Browse the event hub namespace for which you want to add alerts.

3. In the Monitoring section, select Alerts.

4. Go to the Action Groups tab.

5. Select Create to create an action group.
While adding actions, select Webhook for the action type.

6. Paste the URL you copied while adding the integration in Opsgenie into URI.

Microsoft Azure Event Hubs webhook

7. Enable the common alert schema if required.

8. Save the changes.

9. Go to the Alert rules tab.

10. Create a rule or edit an existing rule.

11. Add conditions for filtering alerts.

12. In the Action Group section, add the Webhook action group you created in Step 5.

13. Save the changes.

Sample payload sent from Azure Metric Alert

Create Alert payload (in JSON format)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 { "schemaId": "AzureMonitorMetricAlert", "data": { "version": "2.0", "properties": null, "status": "Activated", "context": { "timestamp": "2020-06-24T10:28:19.3462700Z", "id": "/subscriptions/25b83e19-ab0d-4579-ad81-asdas-sadasda/resourceGroups/test_eventhub_group/providers/microsoft.insights/metricalerts/test-eventhub-alerts", "name": "test-eventhub-alerts", "description": "test description for alert", "conditionType": "SingleResourceMultipleMetricCriteria", "severity": "3", "condition": { "windowSize": "PT1M", "allOf": [{ "metricName": "SuccessfulRequests", "metricNamespace": "Microsoft.EventHub/namespaces", "operator": "GreaterThan", "threshold": "2", "timeAggregation": "Total", "dimensions": [{ "name": "ResourceId", "value": "25b83e19-ab0d-4579-ad81-d0280e506bb3:test-eventhub-og" }, { "name": "EntityName", "value": "test-eventhub" }, { "name": "OperationResult", "value": "Success" }], "metricValue": 8.0, "webTestName": null }, { "metricName": "IncomingRequests", "metricNamespace": "Microsoft.EventHub/namespaces", "operator": "GreaterThan", "threshold": "3", "timeAggregation": "Total", "dimensions": [{ "name": "ResourceId", "value": "25b83e19-ab0d-4579-ad81-d0280e506bb3:test-eventhub-og" }, { "name": "EntityName", "value": "test-eventhub" }], "metricValue": 8.0, "webTestName": null }] }, "subscriptionId": "25b83e19-ab0d-4579-ad81-d0280e506bb3", "resourceGroupName": "test_eventhub_group", "resourceName": "test-eventhub-og", "resourceType": "Microsoft.EventHub/namespaces", "resourceId": "/subscriptions/25b83e19-ab0d-4579-ad81-d0280e506bb3/resourceGroups/test_eventhub_group/providers/Microsoft.EventHub/namespaces/test-eventhub-og", "portalLink": "https://portal.azure.com/#resource/subscriptions/25b83e19-ab0d-4579-ad81-d0280e506bb3/resourceGroups/test_eventhub_group/providers/Microsoft.EventHub/namespaces/test-eventhub-og" } } }

Sample payload sent from Azure Common Alert Schema

Sample payload (in JSON format)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 { "schemaId": "azureMonitorCommonAlertSchema", "data": { "essentials": { "alertId": "/subscriptions/25b83e19-ab0d-4579-ad81-d0280e506bb3/providers/Microsoft.AlertsManagement/alerts/7ccad036-8973-49e9-b628-a18350fb32bb", "alertRule": "test-eventhub-alerts", "severity": "Sev3", "signalType": "Metric", "monitorCondition": "Fired", "monitoringService": "Platform", "alertTargetIDs": ["/subscriptions/25b83e19-ab0d-4579-ad81-d0280e506bb3/resourcegroups/test_eventhub_group/providers/microsoft.eventhub/namespaces/test-eventhub-og"], "originAlertId": "25b83e19-ab0d-4579-ad81-d0280e506bb3_test_eventhub_group_microsoft.insights_metricalerts_test-eventhub-alerts_-121967519", "firedDateTime": "2020-06-29T18:41:05.7016722Z", "description": "", "essentialsVersion": "1.0", "alertContextVersion": "1.0" }, "alertContext": { "properties": null, "conditionType": "SingleResourceMultipleMetricCriteria", "condition": { "windowSize": "PT1M", "allOf": [{ "metricName": "SuccessfulRequests", "metricNamespace": "Microsoft.EventHub/namespaces", "operator": "GreaterThan", "threshold": "2", "timeAggregation": "Total", "dimensions": [{ "name": "ResourceId", "value": "25b83e19-ab0d-4579-ad81-d0280e506bb3:test-eventhub-og" }, { "name": "EntityName", "value": "test-eventhub" }, { "name": "OperationResult", "value": "Success" }], "metricValue": 4.0, "webTestName": null }], "windowStartTime": "2020-06-29T18:38:52.06Z", "windowEndTime": "2020-06-29T18:39:52.06Z" } } } }

Additional Help