Azure Send Event Example

Overview

The following example demonstrates how to send a new event to a Azure Event Hub using an AZURE SB webhook.

The example invokes the Azure Event Hub API Send Event action.

Configuration

Create a new AZURE SB webhook or import the template used in this example. To import the XML template file, open the Alerts > Outgoing Webhooks page, select Import in the split-button located below the table and complete the upload form.

To create a new notification, open the Alerts > Outgoing Webhooks page and click Create.

Parameters

Enter a name and specify the following parameters:

Name Value
Key Name <KEY_NAME>
Primary Key <PRIMARY_KEY>
Service Bus Namespace <EVENT_HUB_NAMESPACE>
Queue/Topic <EVENT_HUB>
Path Parameters timeout=60&api-version=2014-01
Message <MESSAGE_TEXT>

Enter the Azure key name into the Key Name field and the primary key into the Primary Key field.

Modify the Service Bus Namespace by replacing the <EVENT_HUB_NAMESPACE> value with your namespace, for example:

atsd-events

Modify the Queue/Topic by replacing the <EVENT_HUB> value with your hub name, for example:

alert-hub

Modify the Message by replacing the <MESSAGE_TEXT> value with your text, for example:

{
   "status": "${status}",
   "entity": "${entity}",
   "rule": "${rule}",
   "tags": "${tags}",
   "message": ""
}

The Message text contains placeholders that are substituted with actual values when the webhook is triggered. The placeholders specified in the message are visible as editable parameters in the rule editor.

Rule

Create a new rule or import the rule template used in this example. To import the XML template file, open the Alerts > Rules page, select Import in the split-button located below the table and complete the upload form.

To create a new rule, open the Alerts > Rules page and click Create.

Specify the key settings on the Overview tab.

Name Value
Status Enabled
Metric test_m
Condition value > 1

Open the Webhooks tab.

Set Enabled to Yes and choose the previously created webhook from the Endpoint drop-down.

Enable Open, Repeat and Cancel triggers.

Specify the message text into the Message parameter for all triggers.

Test

Test the integration by submitting a sample series command on the Data > Data Entry page.

series e:test_e m:test_m=2

The value causes the condition to evaluate to true, which in turn triggers the notification. To verify that an alert is raised, open Alerts > Open Alerts page and check that an alert for the test_m metric is present in the Alerts table.

Check the Azure Event Hub to ensure the new messages arrived.