Azure OPC Publisher在尝试将OPC UA数据写入云时说“没有收到作业”

问题描述 投票:1回答:1

我正在尝试遵循这些教程:

https://sandervandevelde.wordpress.com/2018/11/06/getting-started-with-opc-ua-on-azure-iot-edge/https://docs.microsoft.com/en-us/azure/iot-accelerators/howto-opc-publisher-run

将数据从opc-ua服务器带到Azure云。

我已经成功完成了https://docs.microsoft.com/en-us/azure/iot-edge/quickstart教程。

我认为OPCPublisher可能找不到配置文件?!

我在C:\ iiotedge \ pn.json下设置了配置文件(更改了IP):

[
  {
    "EndpointUrl": "opc.tcp://my.machine.ip:53530/OPCUA/SimulationServer",
    "UseSecurity": false,
    "OpcNodes": [
      {
        "Id": "ns=3;s=Counter"
      },
      {
        "Id": "ns=3;s=Random"
      }
    ]
  }
]

容器创建选项如下:

{
  "Hostname": "publisher",
  "Cmd": [
    "publisher",
    "--ll=debug",
    "--pf=./pn.json",
    "--di=60",
    "--to",
    "--aa",
    "--si",
    "0",
    "--ms",
    "0"
  ],
  "HostConfig": {
    "PortBindings": {
      "62222/tcp": [
        {
          "HostPort": "62222"
        }
      ]
    },
    "ExtraHosts": [
      "localhost:127.0.0.1"
    ],
    "Binds": [
      "c:/iiotedge:c:/appdata"
    ]
  }
}

opc-publisher的日志输出是:

PS C:\Users\azureuser> iotedge logs OPCPublisher
[06:02:52 INF] Connecting all clients to edgevm using MqttOverTcp. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] Starting Module Host... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:53 WRN] Bypassing certificate validation for client. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 INF] Running in iotedge context. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] [Info] Informational: IotHubConnectionString#50048984 .ctor IAuthenticationMethod is AuthenticationWithTokenRefresh: ModuleAuthenticationWithHsm#5560998  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings[] = Microsoft.Azure.Devices.Client.ITransportSettings[1]  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set IotHubConnectionString = IotHubConnectionString#50048984  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnMethodCalledDelegate = OnMethodCalledDelegate#1525631264  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set Action`1 = System.Action`1[Microsoft.Azure.Devices.Shared.TwinCollection]  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ConnectionStatusChangesHandler = ConnectionStatusChangesHandler#1558992671  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnReceiveEventMessageCalledDelegate = OnReceiveEventMessageCalledDelegate#1523701015  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ProductInfo = .NET/1.24.0 (.NET Core 3.1.3; Microsoft Windows 10.0.17763 WindowsProduct:0x00000030; X64; 176FF90A-591F-574A-86D3-34024A506733)  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [CreateFromConnectionString] Informational: InternalClient#45596481 HostName=edgevm;DeviceId=myEdgeDevice;ModuleId=OPCPublisher Mqtt_Tcp_Only  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: InternalClient#45596481 SetConnectionStatusChangesHandler ConnectionStatusChangesHandler#1809274109  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: RetryDelegatingHandler#39070558 EnsureOpenedAsync Opening connection  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: ProtocolRoutingDelegatingHandler#36936550 ProtocolRoutingDelegatingHandler.OpenAsync Trying Mqtt_Tcp_Only  (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings = MqttTransportSettings#12674872  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: (null) GetEventLoopGroup EventLoopGroup threads count was not set.  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: MqttTransportHandler#46964992 CreateChannelFactory Connecting to 172.23.40.21  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [GenerateToken] Informational: ModuleAuthenticationWithHsm#5560998 2020-05-22T06:02:54.4013728Z 2020-05-22T07:02:54.0000000Z  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] 0: Module myEdgeDevice_OPCPublisher reconnected due to Connection_Ok. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/GET/?$rid=71fb2065-fb60-41e3-b4a5-c15d95292cd1  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Initialize device twin for myEdgeDevice - OPCPublisher (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Applying initial desired state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Reporting currently initial state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] Reporting controller state... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b536d6e8-9ae0-4245-86a2-53e2688e4c06  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] Complete controller state reported (properties: ["JobCheckInterval", "HeartbeatInterval", "MaxWorkers", "IdentityToken"]). (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b7d3c2a6-1daa-4431-8448-10430c29ab8f  (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Module Host started. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_0'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_0 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_1'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_1 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_2'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_2 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_3'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_3 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_4'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_4 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Worker starting... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Try querying available job... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Worker: myEdgeDevice_OPCPublisher_4, no job received, wait 00:00:05 ... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Sending heartbeat... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Could not send worker heartbeat. (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
Microsoft.Azure.IIoT.Exceptions.InvalidConfigurationException: Job orchestrator not configured
   at Microsoft.Azure.IIoT.Api.Jobs.Clients.JobOrchestratorClient.SendHeartbeatAsync(HeartbeatModel heartbeat, CancellationToken ct) in D:\a\1\s\api\src\Microsoft.Azure.IIoT.Api.Edge\src\Jobs\Clients\JobOrchestratorClient.cs:line 69
   at Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker.HeartbeatTimer_ElapsedAsync(Object sender) in D:\a\1\s\common\src\Microsoft.Azure.IIoT.Agent.Framework\src\Agent\Default\Worker.cs:line 147

(编辑以显示日志级别的调试)

我希望在日志中读取一些与OPC UA相关的内容,但事实并非如此。好像工人无法向工作协调员发送心跳?

azure azure-iot-hub opc-ua azure-iot-edge
1个回答
0
投票

面临相同的问题。容器似乎不在appdata中运行,但在app中运行。我已经将createOptions更改为:

{
  "Hostname": "publisher",
  "Cmd": [
    "publisher",
    "--pf=C:/appdata/pn.json",
    "--di=60",
    "--to",
    "--aa",
    "--si=0",
    "--ms=0"
  ],
  "ExposedPorts": {
    "62222/tcp": {}
  },
  "HostConfig": {
    "Dns": [
      "1.1.1.1"
    ],
    "Binds": [
      "c:/iotedge:c:/appdata"
    ],
    "PortBindings": {
      "62222/tcp": [
        {
          "HostPort": "62222"
        }
      ]
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.