Azure / connectthedots

Connect tiny devices to Microsoft Azure services to build IoT solutions
http://connectthedots.io
MIT License
399 stars 274 forks source link

Alerts does not appear on the site #257

Closed vntampasi closed 7 years ago

vntampasi commented 7 years ago

By using the default deploy button with the default settings the alerts are created inside the ehalerts but they does not appear in the website. Can you please give me a piece of help on that? Thanks!

olivierbloch commented 7 years ago

Interesting. I have seen this behavior but I don't remember exactly what the issue was. Can you try running the site locally in debug and put break points to verify that the website backend successfully establishes the connection to the ehalert event hub and check the data read from the EH? Note that you will need to edit the web.config file with the connection strings for EH, IoT Hub and other.

vntampasi commented 7 years ago

Unfortunately my local machine running windows 7 and websockets introduced on IIS 8 so i can't test it. Is there any other option ?

olivierbloch commented 7 years ago

Well, without debug mode, it's harder. Can you try restarting the Website in the portal?

vntampasi commented 7 years ago

I made the restart and once again i can not see anything, the alerts does not appear

olivierbloch commented 7 years ago

How did you validate that the alerts are indeed pushed to ehalerts? If you can see data in there, can you share, to see the format?

vntampasi commented 7 years ago

I connect with eventhub by a console application and i receive the messages as you can see in this link https://drive.google.com/open?id=0B9af0-7oqATQakZwblktbldSdnM

vntampasi commented 7 years ago

I share in the previous post in what way i receive the data. Can you please give me a piece of help on how can i see the alerts?

olivierbloch commented 7 years ago

the format definitively seems ok. Let's try the following: Create a new consumer group for the alerts event hub in the event hub blade in the Azure portal Go to the website blade in the portal, and open "Application Settings", and change the Azure.ServiceBus.EventHub.ConsumerGroup setting to the new consumer group name Restart the website from the portal

vntampasi commented 7 years ago

I made the changes you mentioned above and did a test again but it does not work. Anything else that i can do?

olivierbloch commented 7 years ago

I will try to reproduce on my side if I can today or on Monday. One more thing: can you try redeploying a new instance of the whole project from scratch. Try not connecting any tool to the EH before testing the actual website displays the alerts.

olivierbloch commented 7 years ago

But without being able to debug the site locally it's really hard to determine what is going wrong

vntampasi commented 7 years ago

After debugging the application locally i notice that if you give a "wrong" guid, the site try to send the message back to the device and fail and as a result the synchronization with the event hub close. Thank you

olivierbloch commented 7 years ago

Ok, I need to make it a bit more robust, but are you unblocked? Can we close this issue?

vntampasi commented 7 years ago

Yes we can close it! Thank you much for your help

toolboc commented 7 years ago

I am also noticing the same behavior described by @vntampasi when deploying from the ARM template:

image

Able to workaround by adding try / catch around: IoTHubHelper.SendMessage(messagePayload["guid"].ToString(), alertMessage); in WebSocketEventProcessor.cs

Attempting to message a device that has not implemented a mechanism for message receipt from the IoT Hub appears to be the reason for failure.

olivierbloch commented 7 years ago

Thanks @toolboc and good catch! I just merged the fix and republished binaires for the website so that ARM deployment uses latest bits. If you don't mind testing the deployment on your side, that'd be helpful thanks