Azure / connectthedots

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

Stream Analytics not working #169

Closed mpilant closed 9 years ago

mpilant commented 9 years ago

This is a follow on to #167. Using the latest code, I have done the AzurePrep selecting Stream Analytics to be run, and have everything running to the point where the website is displaying the data. (This is an Intel Galileo Gen 2 with the SparkFun Weather shield.) Covering up the sensor, I can see the light going "on" and "off".

However, no alerts are posted to the website. It appears as though the input, output, and query are correct for the SA job, and it has the status of "Processing". Here is the log information from the light sensor:

5/27/2015 1:25:34 PM Start job 'lmpctd9LightSensor' Running lmpctd9LightSensor Microsoft.StreamAnalytics 286b4bec-1a43-433f-b138-527f516bbfd0 5/27/2015 1:25:29 PM Receive Events Failed lmpctd9LightSensor Microsoft.StreamAnalytics d1b3ba96-fb25-48a8-90b1-d22e3d0421ed 5/27/2015 1:25:29 PM Receive Events Failed lmpctd9LightSensor Microsoft.StreamAnalytics e711ac68-2394-4460-9b02-7c8b3f6a7f70 5/27/2015 1:25:28 PM Receive Events Failed lmpctd9LightSensor Microsoft.StreamAnalytics 556f8a9f-ab34-4551-8bcb-ba2d03468388 5/27/2015 1:25:28 PM Receive Events Failed lmpctd9LightSensor Microsoft.StreamAnalytics 38f3422a-b271-4ba1-9fae-c464991c637a 5/27/2015 1:24:25 PM Start job 'lmpctd9LightSensor' Submitted lmpctd9LightSensor Microsoft.StreamAnalytics 6f3055a2-872e-453d-8b72-6a56079a0497 5/27/2015 1:24:23 PM Start job 'lmpctd9LightSensor' Submitting lmpctd9LightSensor Microsoft.StreamAnalytics 9f395aaf-f97d-4c5a-8b2c-3606ab6ee683 5/27/2015 1:24:23 PM Start job 'lmpctd9LightSensor' Validated lmpctd9LightSensor Microsoft.StreamAnalytics a904762d-5781-4ec0-b4e9-29e2c9837eb5 5/27/2015 1:24:17 PM Start streaming job 'lmpctd9LightSensor' Completed lmpctd9LightSensor Microsoft.StreamAnalytics 2d4f2c93-c96a-4813-ba2f-c8cdc70c36d8 5/27/2015 1:24:17 PM Start streaming job 'lmpctd9LightSensor' Started lmpctd9LightSensor Microsoft.StreamAnalytics 5dd50305-cfa8-4303-98b9-591f1eace20e 5/27/2015 11:37:11 AM Add job 'lmpctd9LightSensor' Completed lmpctd9LightSensor Microsoft.StreamAnalytics 4f20f97a-ba63-49ec-a893-b683a6f8b214 5/27/2015 11:37:11 AM Add job 'lmpctd9LightSensor' Started lmpctd9LightSensor Microsoft.StreamAnalytics 80b98e61-d1d7-4911-

There were several points where I covered the light sensor, but no alert was generated. I noticed the query was looking for a value of 0.02, and the value being shown in the website was about 0.2 when I covered the light sensor. So I modified the query to check for < 0.5 and restarted the job. Even after about 45 seconds at the low (0.2) level no alert was generated.

Any ideas?

mpilant commented 9 years ago

Curiously, when I look at any of the Stream Analytics job's dashboards, they all say "Monitoring data unavailable. Please try again later." where the graph should be. This would seem to indicate no data is being fed to the SA jobs.

mpilant commented 9 years ago

Here are a couple of messages as reported by EHConsole:

sent message:{"displayname":"mpgalileo","guid":"C22B94A0-FD5C-4EB3-9740-08AA1DB684C8","location":"CIL B1213B","measurename":"Temperature","organization":"CPO CIL","subject":"wthr","timecreated":"2015-05-28T13:08:04Z","unitofmeasure":"F","value":77.6131366729736} sent message:{"displayname":"mpgalileo","guid":"C22B94A0-FD5C-4EB3-9740-08AA1DB684C8","location":"CIL B1213B","measurename":"Humidity","organization":"CPO CIL","subject":"wthr","timecreated":"2015-05-28T13:08:04Z","unitofmeasure":"%","value":43.7970581054688} sent message:{"displayname":"mpgalileo","guid":"C22B94A0-FD5C-4EB3-9740-08AA1DB684C8","location":"CIL B1213B","measurename":"Pressure","organization":"CPO CIL","subject":"wthr","timecreated":"2015-05-28T13:08:04Z","unitofmeasure":"inHg","value":29797.689453125} sent message:{"displayname":"mpgalileo","guid":"C22B94A0-FD5C-4EB3-9740-08AA1DB684C8","location":"CIL B1213B","measurename":"Light","organization":"CPO CIL","subject":"wthr","timecreated":"2015-05-28T13:08:04Z","unitofmeasure":"Lux","value":3.50571703910828}

mpilant commented 9 years ago

More information. Yesterday, about 2.5 hours after the SA job started, the following error showed up in the operations log:

Correlation ID: d770306d-b86c-4509-b9f0-d6aabc77bf33

Error: Exception message at level [0], exception number [0], parent exception number [0]: One or more errors occurred. Exception message at level [1], exception number [0], parent exception number [0]: The server was unable to process the request; please retry the operation. If the problem persists, please contact your Service Bus administrator and provide the tracking id. TrackingId:aa7db74cfcfe46d692c6d982b822ff10_G18,TimeStamp:5/27/2015 9:46:47 PM

Message: EventHubReceiver.ReceiveAsync failed. Namespace: sb://lmpctd9-ns.servicebus.windows.net/ Path: ehdevices

Message Time: 2015-05-27 21:46:48Z

Microsoft.Resources/EventNameV2: e02a5e4a-5793-45e3-bdb5-48f10cebaf2b.devicesinput_0_c76f7247_25b7_4ca6_a3b6_c7bf192ba44a#0$0

Microsoft.Resources/Operation: Receive Events

Microsoft.Resources/ResourceUri: /subscriptions/9258ba45-34ef-4d6a-919a-304bdf8830d2/resourceGroups/lmpctdrg9/providers/Microsoft.StreamAnalytics/streamingjobs/lmpctd9LightSensor

Type: EventHubInputAdapterEventHubFailure

mpilant commented 9 years ago

Is there any way to tell whether or not the information is getting from the Event Hub to the Stream Analytics job?

olivierbloch commented 9 years ago

Hi Mark Sorry for the late answer on this one. The errors in the operation logs are definitively not a good sign. You could have gotten some errors about the JSON format of incoming messages being wrong but these are not an issue and don't seem to be what you are seeing. Here are a few things you can try to do:

mpilant commented 9 years ago

do you see anything on the timeline of the stream analytics dashboard? Is it flat?

I'm not sure what you are asking here. If you mean the dashboard in the Azure portal, then no, it is not flat. At least the couple of times I looked. I will add the caveat that when I looked, it was when I manually created the SA jobs. I have not looked since I flushed everything and started over with the latest code.

Did you test the input connection?

Yes. The test reported the connection was successful.

Unfortunately, with other projects needing my attention, I'm going to have to table this effort for a while; and call it a deployment failure for the moment. (If you sense frustration, you are correct. I have been working since the end of March trying to get this all working.)

ghost commented 9 years ago

Closing. Reopen when available to work on.

mpilant commented 9 years ago

Just to follow up as I have been able to get pack to this project...

Without any changes to the code or deployment, I discovered yesterday Azure Stream Analytics started to work. I can only assume there was some underlying issue in Azure which was causing the analytics to not work.

So all is working at this point.