Search code examples
azureazure-iot-hubazure-iot-edge

What is "Connected Client Count" on Azure IoT Edge dashboard


I need to know how to get "Connected Client Count" from API rest or go SDK, but I did not find any reference of what does it really means. From where "Connected Client Count" comes?

My guess: The "Connected Client Count" is calculating doing the following:

  • Get the device list from API.
  • For one of these devices get the modules from API
  • Now it could return many modules depending on your architecture, so in my case it will ignores agent and hub modules, considering just other nodeRed modules as a real client. If the client (nodeRed module) connectionStatus == connected so this is a valid client connect and should return +1.

I would be very glad for an explanation of this or some doc references.

image


Solution

  • The "Connected Client Count" that you find in the Azure Portal reflects the amount of modules and/or devices that are currently connected to your edgeHub. It gets these values from the reported properties in the Module Twin of your edgeHub module. If you take a look in the Module Twin you will find something similar to this in the reported properties:

    "reported": {
          "schemaVersion": "1.0",
          "version": {
            "version": "1.0.10.1",
            "build": "36502453",
            "commit": "3b3dfcc099921bc2e4632105b49df551b1c5211c0"
          },
          "lastDesiredVersion": 39,
          "lastDesiredStatus": {
            "code": 200,
            "description": ""
          },
          "clients": {
            "device-name/SomeModule": {
              "status": "Connected",
              "lastConnectedTimeUtc": "2020-11-26T10:10:17.6134347Z"
            },
            "device-name/SomeOtherModule": {
              "status": "Connected",
              "lastConnectedTimeUtc": "2020-11-26T10:10:17.6278367Z"
            }
          },
    

    You can find out more on the reported properties of this module here