Is there a way to retrieve the total message count for a specific device?

David Maelfait 26 Reputation points
2021-02-25T10:58:54.867+00:00

We want to be able to programmatically disable a device in case it sends too many messages (unexpected behaviour).

For this to work, we need a way to measure the amount of messages that has been sent from the device (too be more specific, from an iot edge device) to the iothub and vice versa within a certain time frame.

All I could find is a way to retrieve the total message count for all connected devices.

Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
378 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sander van de Velde 28,386 Reputation points MVP
    2021-02-25T19:10:55.687+00:00

    @David Maelfait ,

    The metrics on the IoT Hub only report on a meta-level about the health, usages, etc. of the IoT Hub, not for individual devices.

    To get a count per device per time interval, you have to add the logic yourself.

    This is not that hard with custom logic in eg. Azure Stream Analytics or an Azure Function.

    Still, there are costs involved for these extra services just to handle a 'copy' of the message so a counter can be incremented or a group by on an ASA window can be executed.

    So, if you are able to combine it with existing logic which is picking up the messages already, you can save some resources...

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful