0
votes

I have a IOT Hub which receive messages (avro format) from connected device. I want to configure the alerts (under IOT Hub Monitoring section) based on the specific values in the message however it seems alerting don't have provision to configure rule based on the date being sent by device.

Any pointers on this? is this possible or any alternate option?

Thanks, Bhupal

1

1 Answers

0
votes

You can have Azure Stream Analytics job to do that.It would read message sent in Avro format and then act on it based on a rule. Pleas refer to this doc on how to use SQL Azure as your reference data in RuleEngine

http://learniotwithzain.com/2019/08/alert-engine-using-azure-stream-analytics-and-sql-azure-as-reference-data/

Few more links to help you with that: Rules engine for Stream Analytics on Azure

https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-threshold-based-rules

An alternative option would be to use AzureFunctions also but that would need you to do all the underlying stuff which is pretty easy with Azure Stream Analytics.

An example of Azure Functions: Here the message is intercepted and then passed to a different eventhub after

    [FunctionName("IotDeviceAnalytics")]

    public static async Task Run(
   [IoTHubTrigger("iothub-eventhubname", Connection = "IotHubConnectionString", 
    ConsumerGroup = "consumergroup")] EventData[] events,
    [EventHub("eventhubconnectionstring", Connection = 
    "EventHubConnectionString")]IAsyncCollector<string> outputEvents,
    ILogger log)
    {         

        foreach (EventData eventData in events)
        {
            //eventData would have your message

        }
    }

But as with all components of Azure please do check cost and size limitations. Using SQL Azure as reference data for rule engine has limitation on size of Rule that can be saved as reference data.