我的问题可能和这个职位一样,但我不明白那些花哨的大城市堆积如山的政治,所以我不想打扰任何人,只想问我自己的问题。
我想连接我的Windows作为“边缘设备”到我的Azure IoT集线器,根据微软教程这里。当我只运行"temperatureSensor"-module时,一切都很好,这是微软存储库中的图像。模块运行,连接到集线器容器,它将数据发送到蔚蓝集线器。
下一步是编写自定义模块。在Microsofts网站上也有一个教程,它为C#和Python提供了一个模板,可以为任何目的进行修改。我尝试了这两个示例(C#和Python),但只有C#版本起作用,没有任何进一步的问题。但是,由于我不太精通C#,只有Python,所以我也需要让它运行。
但是Python版本在下载图像并启动容器后不久就失败了。edgeAgent和edgeHub以及Mock-"temperatureSensor“模块像以前一样运行时没有问题。但是自定义python模块似乎无法连接到集线器容器。码头日志如下所示:
edgeAgent:
2018-06-22 10:28:26.062 +00:00 [INF] - Plan execution started for deployment 8
2018-06-22 10:28:26.062 +00:00 [INF] - Executing command: "Command Group: (
[docker stop -t 10 filterModule]
[docker start filterModule]
[Update health stats for module filterModule]
)"
2018-06-22 10:28:26.062 +00:00 [INF] - Executing command: "docker stop -t 10 filterModule"
2018-06-22 10:28:26.063 +00:00 [INF] - Executing command: "docker start filterModule"
2018-06-22 10:28:26.567 +00:00 [INF] - Executing command: "Update health stats for module filterModule"
2018-06-22 10:28:26.567 +00:00 [INF] - Plan execution ended for deployment 8
2018-06-22 10:28:26.872 +00:00 [INF] - Updated reported properties
2018-06-22 10:28:56.975 +00:00 [INF] - HealthRestartPlanner is clearing restart stats for module 'edgeHub' as it has been running healthy for 00:10:00.
2018-06-22 10:28:56.975 +00:00 [INF] - Plan execution started for deployment 8
2018-06-22 10:28:56.975 +00:00 [INF] - Executing command: "Reset health stats for module edgeHub"
2018-06-22 10:28:56.977 +00:00 [INF] - Plan execution ended for deployment 8
2018-06-22 10:28:57.263 +00:00 [INF] - Updated reported properties
2018-06-22 10:29:02.268 +00:00 [INF] - HealthRestartPlanner is clearing restart stats for module 'tempSensor' as it has been running healthy for 00:10:00.
2018-06-22 10:29:02.268 +00:00 [INF] - Plan execution started for deployment 8
2018-06-22 10:29:02.268 +00:00 [INF] - Executing command: "Reset health stats for module tempSensor"
2018-06-22 10:29:02.268 +00:00 [INF] - Plan execution ended for deployment 8
2018-06-22 10:29:02.571 +00:00 [INF] - Updated reported propertiesedgeHub:
2018-06-22 10:26:14.438 +00:00 [INF] - Attempting to connect to IoT Hub for client xxxdevice/filterModule via AMQP over WebSocket...
2018-06-22 10:26:14.439 +00:00 [INF] - New token requested by client xxxdevice/filterModule, but using existing token as it is usable.
2018-06-22 10:26:14.789 +00:00 [INF] - Connected to IoT Hub for client xxxdevice/filterModule via AMQP over WebSocket, with client operation timeout 60000.
2018-06-22 10:26:14.793 +00:00 [INF] - Closed cloud proxy for device xxxdevice/filterModule
2018-06-22 10:26:14.793 +00:00 [INF] - No session state found in store for xxxdevice/filterModule
2018-06-22 10:26:14.793 +00:00 [INF] - New cloud connection created for device xxxdevice/filterModule
2018-06-22 10:26:14.793 +00:00 [INF] - Successfully authenticated device xxxdevice/filterModule
2018-06-22 10:26:14.793 +00:00 [INF] - Successfully generated identity for clientId xxxdevice/filterModule and username xxx-iothub.azure-devices.net/xxxdevice/filterModule/api-version=2016-11-14&DeviceClientType=iothubclient%2f1.1.31%20(native%3b%20Linux%3b%20x86_64)
2018-06-22 10:26:14.793 +00:00 [INF] - ClientAuthenticated, xxxdevice/filterModule, 084e3167
2018-06-22 10:28:26.580 +00:00 [INF] - Attempting to connect to IoT Hub for client xxxdevice/filterModule via AMQP...
2018-06-22 10:29:26.583 +00:00 [INF] - Attempting to connect to IoT Hub for client xxxdevice/filterModule via AMQP over WebSocket...
2018-06-22 10:29:26.584 +00:00 [INF] - New token requested by client xxxdevice/filterModule, but using existing token as it is usable.
2018-06-22 10:29:26.918 +00:00 [INF] - Connected to IoT Hub for client xxxdevice/filterModule via AMQP over WebSocket, with client operation timeout 60000.
2018-06-22 10:29:26.919 +00:00 [INF] - Closed cloud proxy for device xxxdevice/filterModule
2018-06-22 10:29:26.923 +00:00 [INF] - No session state found in store for xxxdevice/filterModule
2018-06-22 10:29:26.923 +00:00 [INF] - New cloud connection created for device xxxdevice/filterModule
2018-06-22 10:29:26.924 +00:00 [INF] - Successfully authenticated device xxxdevice/filterModule
2018-06-22 10:29:26.924 +00:00 [INF] - Successfully generated identity for clientId xxxdevice/filterModule and username xxx-iothub.azure-devices.net/xxxdevice/filterModule/api-version=2016-11-14&DeviceClientType=iothubclient%2f1.1.31%20(native%3b%20Linux%3b%20x86_64)
2018-06-22 10:29:26.924 +00:00 [INF] - ClientAuthenticated, xxxdevice/filterModule, 126cb7eb
2018-06-22 10:31:33.659 +00:00 [ERR] - Module filterModule is not connected过滤器:
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609]
IoT Hub Client for Python
Adding TrustedCerts from: /mnt/edgemodule/edge-device-ca.cert.pem
set_option TrustedCerts successful
Starting the IoT Hub Python sample using protocol MQTT...
The sample is now waiting for messages and will indefinitely. Press Ctrl-C to exit.
Error: Time:Fri Jun 22 10:28:57 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:InitializeConnection Line:2003 mqtt_client timed out waiting for CONNACK这是无穷无尽的重复。看来集线器确实注意到了筛选器,但是身份验证成功了,但是访问无论如何都被拒绝了。这是否是Python中的一个bug,因为正如我所说的,它在C#-版本(在其他情况下)中非常好地工作。或者它有可能是防火墙问题。我并不认为这是真的,因为过滤器日志显示了MQTT问题。据我所知,MQTT只适用于内部边缘设备流量,而不适用于传出通信量(外部对接者和设备)。所以防火墙不应该是个问题(?)实际问题显然是等待集线器确认连接的超时。因此,集线器没有收到连接请求,或者没有回复,或者回复丢失了。
谢谢你提前提供帮助。
发布于 2018-07-06 09:53:34
自从这篇文章发表以来,我也有机会在一次会议上与微软的人交谈。当我们试图复制这个问题时,结果发现整个过程在前一天被改变了。Iotedgectl现在是一个Windows服务(据我以前所说,它只是一个常规进程,这有意义吗?)
不管怎么说,整个物联网边缘现在似乎都被大修了。因此,在我的经验中,会有很大的变化,我乐观地认为,下次我尝试这些教程时,一切都会很好。我要结束这条线。
发布于 2018-06-25 05:47:46
我假设您试图在Windows设备上运行Windows容器。当前不支持Windows容器上的Python (和C)自定义模块。这与我们存储和检索密钥的方式有关。虽然我们目前没有任何ETA,但这一特性肯定在路线图上。有几种方法可以避免这种情况:
发布于 2018-06-28 15:18:26
我在Linux设备上使用Linux 也遇到了同样的问题。我所有的模块都是用编写的,除了一个是 Analytics。
为了解决这个问题,我不得不卸载蔚蓝-物联网-运行时-ctl.这不是一种解决问题的“适当”方法,但它奏效了!这是我的剧本:
sudo pip3 uninstall azure-iot-edge-runtime-ctl
sudo pip3 install azure-iot-edge-runtime-ctl
sudo iotedgectl setup --connection-string "<your connection key>" --auto-cert-gen-force-no-password
sudo iotedgectl login --address <your container registry address> --username <your container registry username> --password <your container registry password>
sudo iotedgectl start如果有人有更好的主意,我也会对解决这个问题感兴趣.?
https://stackoverflow.com/questions/50986361
复制相似问题