Azure OPC Publisher says "no job received" when trying to write OPC UA data to cloud

1

im trying to follow those tutorials:

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

to bring data from an opc-ua server to the azure cloud.

I have already successfully played through the https://docs.microsoft.com/en-us/azure/iot-edge/quickstart tutorial.

I think maybe the OPCPublisher does not find the configuration file?!

I set up the configuration file under C:\iiotedge\pn.json (with changed ip):

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

The container create options are as following:

{
  "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"
    ]
  }
}

The log outputs from opc-publisher are:

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

(edited to show log level debug)

I would expect to read something OPC UA related in the logs, but this is not the case. Seems like the worker is not able to send a heartbeat to job orchestrator?

azure
azure-iot-hub
opc-ua
azure-iot-edge
asked on Stack Overflow May 21, 2020 by jmundorf • edited May 22, 2020 by jmundorf

1 Answer

1

Was facing the same issue. It looks like the container is not running in appdata but in app. I've changed the createOptions to:

{
  "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"
        }
      ]
    }
  }
}
answered on Stack Overflow May 24, 2020 by Dieterg

User contributions licensed under CC BY-SA 3.0