Search code examples
azureazure-iot-hubazure-monitoring

Azure IoTHub - How to get usage data per device


I am using Azure Monitor to view diagnostics/logs for my IoTHub. In the metrics available for IoTHub there is deviceDataUsage. As I understand it, this is the total data usage for all of the devices connected to this IoTHub.

Is there a built-in monitoring/logging solution to Azure IoTHub that would allow me to view per device data usage? Or will I need to use a different tool, such as stream analytics, to build my own solution?


Solution

  • Unfortunately there isn't a way to get the data usage for an individual IoT device through similar means as the monitoring tab of IoTHub nor through Kusto query.

    There is a sort of a workaround. It would require some level of development on your end, if you are routing the messages to an event hub you can read directly from there and do aggregation on system property for device-id. Information on this can be found here: https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host#receive-messages. Alternatively, another form of workaround is to include the device-id in the telemetry message being sent and the messages be queried internally on your end to separate messages with specific device-id’s. These are all merely suggestions that can or cannot be used based on your business needs of course.

    Finally you can reach out directly to assisted-support team and request the device usage on a case-by-case basis.