I have a number of devices deployed with edge modules running on them. I created a deployment in Azure Portal that targets all devices which sets the environment variables and docker settings. The deployment does not set the twin settings.
I then went into the Azure portal, clicked on the individual devices, clicked "Set modules" and set specific twin module settings for each device.
The problem now is after a period of time some of the devices are receiving an transient network error to Azure Hub which causes them to reload the module twin configuration, however some of the devices load a totally empty twin config, It will continue to periodic auto refresh twin settings with the empty twin settings. If i restart the iotedge service it refreshes the twins and will pull down the correct twin config again and continue to run as expected for a period.
This is a major issue because the modules are basically hung until I log in and manually restart the iotedge service.
Is this the correct way to configure edge modules? or am I missing something?
Thanks
After reading the following post it appears we did not properly implement a handler for twin patches. I think the edge runtime calling the twin update hook with no properties after a connection interruption is a bug however we were able to write logic to handle it based on the examples provided in the post.
https://github.com/Azure/iotedge/issues/1654#issuecomment-551258642
Related
I'm developing a multi module scenario using IoTEdge and I need to test Direct Methods Communication using the development environment (Debugging/Simulator).
I've tested the following scenario:
Scenario:
Device1
Module1 - Subscribes SetMethodHandlerAsync (Method1)
Module2 - Calls InvokeMethodAsync (Device1, Module1, Method1)
Results:
It was impossible to reach the destination module due the missing device registration
{"message":"Client rramalho-device not found"} not registered
There is any way to debug direct methods communication without pushing modules to Cloud and having the device running directly in the device ?
You can either simulate a device to debug solutions with multiple modules or simulate a single module application.
A new setting in Azure IoT Tools that enables injection of environment settings into the Visual Studio Code command palette and Azure IoT Edge terminals, you can now build and debug modules on remote devices.
For more information refer this official documentation
Is it possible to read events from IoT hubs in a way that we receive all status changes for IoT edge module installs? Possibly by receiving state changes to the edge agent reported properties of all connected devices?
Background: We are allowing users to "install" applications (represented by edge modules) on their edge devices on the fly through our own portal. We want to monitor changes to IoT devices and their modules, and note the changes in our database, so we can flag the corresponding apps as installed, removed, or failed.
Right now I can only find Event Grid based events for Device connected / disconnected events. I can also see that I can manually query the desired properties of each edge device's edge Agent separately. But since we will a large number of edge devices connected (>5000), polling them all just to see if something changed is not feasible.
Are the edge agent status changes of all IoT edge devices available as an event stream somewhere? Or is there a better solution?
IoT Edge's integration with Azure Monitor may help (docs). It has a module view that shows which modules are running and their availability. Since all the data is available in Log Analytics, you can create custom visualizations and processes using the data.
The Module twins in Azure IoT Hub shall help in below based on the information stored with it.
Monitoring the connectivity of the system
Monitoring the health of IoT Edge deployments
The Azure IoT Edge runtime has "IoT Edge Agent" as one of two modules that performs installation / initiation of modules and updating / reporting of the status of the modules to the IoT Hub. The $edgeAgent maintains the health and connectivity data about both the IoT Edge agent and IoT Edge hub runtime modules.
The Azure IoT Edge hub runtime maintains the data about communications between the "IoT Edge hub" running on the device and that of Azure IoT hub via the $edgeHub.
High level Overview :
Here is "Azure Monitor workbooks for IoT" that provides views couple of views :
An overview / state of active devices can be seen in the "Devices" View
Alerts display as per rules configured for the devices in "Alerts" View
Azure Monitor workbooks can be tuned for seeing data at any level (device state, app status) of interest. The public templates can be modified to meet the need/requirement in hand. The data shall fetched based on resource-centric KQL queries on the InsightsMetrics table.
Screenshot of Devices View :
Screenshot of Alerts View:
References :
Monitor Module Twins
Monitor Workbooks
For Sphere devices, we can vscode/cli to deploy, debug and see logs of the application [1]. But later (say I kept it running for 24 hours and comes back), if I wish to see application logs, it looks like, I don't have a way. Is there a way to see application logs on Sphere development boards without initiating the debugger?
To be clear, this is not about monitoring applications deployed in production [2]. This is only about development logs on Azure Sphere development boards. An example is logcat in Android [3]. The intention is to analyse long running application on Azure Sphere. We cannot keep the debugger attached forever.
This is a late response and you've probably figured it out by now but if your Azure Sphere device is connected to a network, you can send debug logs over a UDP socket without the need for the device to be attached to the Visual Studio debugger or even a PC.
Here's an example application that modifies the Log_Debug library to send the output over UDP to a receiver application that writes the output to a "deviceLog.txt" file.
I am currently in the beginnings of developing an integrated Sonos app, and to get a better understanding of what needs to happen, I downloaded Sonos's provided sample server for the "Acme" service.
On first use, I was able to get it working and was able to play songs from the static directory that was provided within the package. However, after closing the server, leaving my computer for some time, and booting it back up again with ./gradlew bootRun, I noticed that I was not able to use the sample service anymore. On the window to link the sample account, it said that there was an error in authenticating and that it might be an issue with the connection.
First things first, I rebooted everything I could reboot. Turned the gradle server on then off. Removed the service and created it again. I even did a factory reset and put the Sonos device (PLAY:1 variety) on a different network at the office. The sample service still won't authenticate.
What could be causing the authentication for the sample Acme service to stop working just like that on every network? I should mention that I have been using the same config settings ever since I got it to work the first time, so it should not be a problem with my configurations in the customSD page. Also, I have not changed any code within the sample server.
TL;DR: The Sonos sample server worked one time for me, and hasn't worked since on multiple networks and devices, even after a factory reset. What could be causing this issue?
It sounds like the player possibly can't find the sample server any more. When you set up the service via customsd, you used an ip address for the endpoint. Is it possible that ip address has changed?
I am developing windows store apps for the surface tablet.
I am remote debugging onto a surface tablet via the local network. At first I had no issues with this, and then occasionally about one out of every four times it would fail to deploy, and I would get the message:
Error: Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named 'my_debugging_tablet'. The debugger cannot connect to the remote computer. The debugger was unable to resolve the specified computer name.
Initially when this happened, I would simply deploy the project again and the error would not occur again, or, occasionally, I would close and then re-open the Remote Debugging Monitor on the tablet, but generally this would happen seemingly randomly and not re-occur.
However, lately, it has been happening more and more often (with no changes to my code) and now I have been unable to deploy at all, ever, for a couple of days now (and thus I cannot debug on my tablet.)
The same error message listed above is what displays every time I try to deploy or debug.
I verified in project properties that the target device and remote machine name were set correctly, and each time verified that the connection on both the surface tablet and my host computer were fine (my host machine is Windows 8 on Oracle Virtualbox.)
From project properties, if I attempt to manually "Find" the target device (as it does when you deploy back when this used to work) it is unable to locate my tablet (or anything) on my local network. ("Found 0 connections on my subnet")
My MS developer license registration is up to date as well. Additionally, there doesn't seem to be an issue the local network, as both my host machine and the tablet can "see" other things on the network (printers, etc.)
I can't for the life of me figure this out, because, as I mentioned, there have not been any changes to anything such as developer license registration, network status, code, or anything else that should have affected this.
I originally read your question and thought you were saying the two devices could see each other, except through Visual Studio. I was scratching my head at that.
Visual Studio just uses the OS to resolve names and addresses. I recommend troubleshooting the connectivity problems outside of VS, as the problem is larger than just trouble with remote debugging.
Try nbtstat -n to verify you can see what you expect on your network.