Azure Event Hub gone offline - azure

Our azure event hub has been running for a few months now in a production environment. Today the event hub stopped receiving inputs and processing any outputs. Not sure what the problem is?
Our stream analytics also can't connect to the event hub anymore - also one of the stream jobs has a status of 'degraded'. Could this be the cause for the whole hub to go down?

Most likely the degraded status of your Stream Analytics job is caused by the Event Hub access issue. You can confirm this from the job's activity log.

Related

Azure function missing IoT hub trigger messages

I have created an Azure function to route messages from an IoT hub to an Azure SQL DB using the IoTHubTrigger following mostly the instructions in this link Azure Functions - how to set up IoTHubTrigger for my IoTHub messages?.
Each IoT device captures data every 8 minutes. When capturing is done, the device streams the data in 4 different messages. Then the azure function takes over to write these 4 different messages to the database.
When only one device was streaming, I had no issues with the data, which where written in the db and I could also see/monitor events/messages using az iot hub monitor-events.
When a second device started streaming in the same IoT hub, I started missing messages, meaning that from each device only one message is being stored in the db. Also when using iot hub monitor-events only one message appears from each device. I was also expecting that if I disable the 2nd device, then the 1st one will go back to normal. Unfortynately the issue remains the same.
So my question is: how is it possible a 2nd device screwing up the way that the 1st one interacts with the hub?
If that's not the case, then how we are supposed to figure out what causes the problem at this stage?
Thanks :)
Difficult to say without more details. Are you routing messages in IoT Hub somewhere else? I would go back to a clean IoT Hub with one device and create a consumer group on the IoT Hub for the function. Before running the function I would monitor that consumer group (I like to use the Azure IoT Explorer application) to see if data is coming through as expected, then add another device and keep monitoring the same consumer group. If data is coming through then start the function (consuming data from the consumer group).
If telemetry was not getting read from the IoT Hub consumer group then you will need to look at your device code for any issues.

IoT hub event ingestion and data storage

I'm using an Azure stream Analytics job to process the data from an IoT hub. So my data comes from my simulated device to an IoT hub and I have configured the hub as an input to the stream analytics job and a blob storage as an output job.
My question is if I stop the stream analytics job and restart it, do I lose the data between stop and start? Or is the data stored on the IoT hub and when I restart the job and select the start time as from when it stopped, I'll get all the data.
As krishmam said, you can choose the outputStartMode when starting a job. Specifies if the job should start producing output at a given timestamp or at the point when the job starts.
You won't lose any data. Stream Analytics gives you an option to start a job from the previous stop time when you start the job.

Logic App Not Receiving Messages

I posted this question a couple of days ago SMS Messaging from Azure IOT Hub
I have attempted to implement the logic app that had been suggested, my problem is no messages are being received by logic app through the service bus, in fact no messages are reaching the service bus. When I try to run the trigger in the logic app it gives me a pop-up saying "When_a_message_is_received_in_a_queue". When I run the logic app it says the work flow has timed out after a couple of minute.
I copied what this guy done except when he sends the emails I added a twilio connector.
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-monitoring-notifications-with-azure-logic-apps
The messages that I am sending from my device to my IOT hub are being received by stream analytics, is it possible that stream analytics is stopping the messages from being fed to the service bus? The input to stream analytics is a data stream.
Thanks for any help and sorry if this is a silly question.
You can verify if the message are indeed reaching your Service Bus queue by using tools like Service Bus Explorer. That would help narrow down the problem to either IoTHub -> ASA pipeline -> Service Bus pipeline or Service Bus -> Logic App.

Do devices reconnect if IoT Hub restarts?

I'm wondering if devices connected to an IoT Hub reconnect to it (or if they just crash) if IoT Hub for some reason stops and starts again after a while. E.g. if the subscription runs out.
I've been trying to test this but can't find out how to stop my IoT Hub and restart it.
There is no way to stop an IoT Hub. As mentioned here, the IoT Hub will accept messages beyond the limits for a while, but at some point it will refuse the messages (i.e. returns an error). This is something you can detect in your device's code that is sending the events.
You may try to setup a test account with small balance, when this account is overdue the IoT hub status is stopped. You can test under this situation.
And for test purpose to stop IoT hub for a while you can vote up this suggestion.

How can I Implement the logic for to send the values of event hub (filtered values by stream analytics job) to IoT Hub using UWP App?

I am currently working on Internet Of Things, in my current project I was implemented the logic for to send temperature values to IoT Hub (using Raspberry PI2 and BMP280 sensor), in the azure part I created stream analytics job for receiving the messages from IoT Hub and filters those values based on my query like if temperature value exceeds 30 deg and post those filtered values to event hub is one of the output of the stream analytics job.
Query I wrote in stream analytics job.
SELECT
System.timestamp AS Time,
DeviceId,
RoomTemp,
RoomPressure,
RoomAlt
INTO
eventhub
FROM
bmpsensordata
WHERE RoomTemp>35
I was already created one event hub in azure, and monitor those filtered values by stream analytics job, in dashboard of event hub what I was created earlier.
But I want to send the values (filtered values by stream analytics job) of event hub to IoT Hub from that I will receive the values in the form of alert message/ notification using UWP App(C# language).
Please tell me how I can do it above scenario.
Regards,
Pradeep
I think that your solution could look like in the diagram I prepared:
Once data is retrieved from the IoT Hub and analyzed by Stream Analytics it can call Azure Function which triggers Azure Notification Hub to send push notification to your UWP application.
Please use my tutorial to see how to use Stream Analytics together with Azure function and at the end how to send SMS alerts - in your case you should replace the code with the one for Notification Hub:
https://github.com/Daniel-Krzyczkowski/Daniel-Krzyczkowski.github.io/blob/master/cloudyofthings/article1/index.md
Here is the documentation how to use Notification Hub SDK and how to integrate it with UWP applications:
https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-aspnet-backend-windows-dotnet-wns-notification
I think you will need another Stream Analytics job with Event Hub as input, and IoT Hub as output. Then you can receive the cloud-to-device messages from IoT Hub in your UWP application as described in this article.
You can have multiple output from a single Stream Analytics job. Refer to https://blogs.msdn.microsoft.com/streamanalytics/2015/09/16/query-pattern-of-the-week-send-data-to-multiple-outputs/ for more information on this.
Stream Analytics does not have a direct output to IoT hub though.
You'd need to put the info in to an EventHub and have a worker role process this and send the info from there in to IoT hub
Per my experience, I think you can try to integrate Notification Hub with IoTHub, Stream Analytics, Event Hub to implement your needs. Please see the details below.
Create a Stream Analytics Job with IoTHub as input and Event Hub as output for filtering sensor data.
Create a Notification Hub for pushing data to UWP app.
Create an server service or a scheduler job for receiving and sending the data from the Event Hub to the Notification Hub, such as continuous WebJob.
As references, there are some documents which show you how to do it.
Get started with Azure Stream Analytics to process data from IoT devices
, https://azure.microsoft.com/en-us/documentation/articles/stream-analytics-get-started-with-azure-stream-analytics-to-process-data-from-iot-devices/
Getting started with Notification Hubs for Windows Store Apps, https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-windows-store-dotnet-get-started/
Event Hubs programming guide, https://azure.microsoft.com/en-us/documentation/articles/event-hubs-programming-guide/
Notification Hub Server SDK reference for .NET, https://msdn.microsoft.com/library/mt414893.aspx
Create a .NET WebJob in Azure App Service (run continuously), https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-get-started/
Hope it helps.
Any concern, please feel free to let me know.

Resources