1

I have a problem with an Edge device that I have. Even though no devices are sending any data, the message quota is seeing a lot of traffic even though no messages are beeing sent. For example 14000 messages will be accumulated during 7 hrs or so.

Is there any way to debug the internal messages?

I've checked with docker logs edgeHub and docker logs edgeAgent but nothing out of the ordinary there.

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
JohnSDev
  • 54
  • 1
  • 6
  • Is there any other module except edgeHub and edgeAgent? What if you disable edge device connect to iot hub? – Rita Han Feb 26 '18 at 06:52
  • Hi. I hade two modules but those are disabled. When the edge device runtime is stoped the no more internal messages are sent. I have a colleague who have the same issue on his system with the same implementation. Using the iotedge cli runtime for python 1.6 preview I believe – JohnSDev Feb 27 '18 at 07:32
  • If other two modules enabled, can they send messages? How many? – Rita Han Feb 27 '18 at 08:22
  • Hi. They will send messages “device originated” as programmed no problem. Background messages as the problem above will still accumulate.doesn matter if I have a device or module that sends or not. As long as the edge runtime is started there are a lot of background messages being sent that I don’t know anything about. I have tried to do a whole new solution with new Hub and devices is still the same. I understand that maintenance messages need to sent like status etc. but 14000 in 7hrs seems a bit too much? – JohnSDev Feb 27 '18 at 08:52
  • Where do you see these messages? Can you read these messages from iot hub? You can check Metrics from azure portal to see what kind of messages. – Rita Han Feb 27 '18 at 09:24
  • Hi. I see them on the Azure portal, iothub, overview. Ive tried to look at all the metrics but to only "param" is the toal counter. No other parameter shows them what I can see. – JohnSDev Mar 01 '18 at 12:01
  • What's the meaning of "param"? Can you show us a snapshot? – Rita Han Mar 02 '18 at 01:48
  • From 9:00 AM to 5:30 PM, I get 334 messages in azure iot hub portal. And from metrics, some of they are device twin read. – Rita Han Mar 02 '18 at 09:45
  • Sorry. By params i mean each value to look at in metrics. When looking at the total messages. For ex ”total messages” it shows te total amount. For ex 14000 during the last 24h. But no other value would actually show What type of msg they were. Like failed c2d or twins. Is like they are debug messages or pings that should not ve trated within the pricing plan. We are using a free plan for the Iothub btw – JohnSDev Mar 02 '18 at 10:42
  • For your issue, you can give a feedback [here](https://feedback.azure.com/forums/907045-azure-iot-edge). – Rita Han Mar 05 '18 at 08:37

1 Answers1

0

If it can help someone, I had this kind of problem yesterday, sending message from my edge device with a Python test app and never find it on the cloud. I missed the async behaviour of the send_message function.

You should have something like :

# At the beginning of you code

# Create an IoT Hub client
client = IoTHubModuleClient.create_from_edge_environment()
# connect the client.
await client.connect()

# ... and in your main loop

# Send the message.
await client.send_message(message)

Your Python app should use asyncio. If you forgot await for send_message, your code will not produce errors but it just won't work.

If it works, you should see a bunch of azure sdk debug logs with a docker logs of your Python app, like :

2020-04-29 08:00:13,032 - async_clients - azure.iot.device.iothub.aio.async_clients - INFO - Sending message to Hub...
2020-04-29 08:00:13,032 - pipeline_thread - azure.iot.device.common.pipeline.pipeline_thread - DEBUG - Starting run_op in pipeline thread
2020-04-29 08:00:13,033 - pipeline_ops_base - azure.iot.device.common.pipeline.pipeline_ops_base - DEBUG - SendD2CMessageOperation: creating worker op of type MQTTPublishOperation
2020-04-29 08:00:13,033 - pipeline_stages_base - azure.iot.device.common.pipeline.pipeline_stages_base - INFO - AutoConnectStage(MQTTPublishOperation): Connected.  Sending down and adding callback to check result
2020-04-29 08:00:13,033 - pipeline_stages_mqtt - azure.iot.device.common.pipeline.pipeline_stages_mqtt - INFO - MQTTTransportStage(MQTTPublishOperation): publishing on devices/<DEVICE NAME>/modules/<MODULE_NAME>/messages/events/<PROPERTIES>
2020-04-29 08:00:13,033 - mqtt_transport - azure.iot.device.common.mqtt_transport - INFO - publishing on devices/<DEVICE NAME>/modules/<MODULE_NAME>/messages/events/<PROPERTIES>
2020-04-29 08:00:13,033 - client - paho - DEBUG - Sending PUBLISH (d0, q1, r0, m8), 'b'devices/<DEVICE NAME>/modules/<MODULE_NAME>/messages/events/<PROPERTIES>'', ... (65 bytes)
2020-04-29 08:00:13,033 - mqtt_transport - azure.iot.device.common.mqtt_transport - DEBUG - _mqtt_client.publish returned rc=0
2020-04-29 08:00:13,033 - mqtt_transport - azure.iot.device.common.mqtt_transport - DEBUG - Waiting for response on MID: 8
2020-04-29 08:00:13,046 - client - paho - DEBUG - Received PUBACK (Mid: 8)
2020-04-29 08:00:13,047 - mqtt_transport - azure.iot.device.common.mqtt_transport - INFO - payload published for 8
2020-04-29 08:00:13,047 - mqtt_transport - azure.iot.device.common.mqtt_transport - DEBUG - Response received for recognized MID: 8 - triggering callback
2020-04-29 08:00:13,048 - pipeline_thread - azure.iot.device.common.pipeline.pipeline_thread - DEBUG - Starting on_published in pipeline thread
2020-04-29 08:00:13,048 - pipeline_stages_mqtt - azure.iot.device.common.pipeline.pipeline_stages_mqtt - DEBUG - MQTTTransportStage(MQTTPublishOperation): PUBACK received. completing op.
2020-04-29 08:00:13,049 - pipeline_ops_base - azure.iot.device.common.pipeline.pipeline_ops_base - DEBUG - MQTTPublishOperation: completing without error
2020-04-29 08:00:13,049 - pipeline_ops_base - azure.iot.device.common.pipeline.pipeline_ops_base - DEBUG - SendD2CMessageOperation: Worker op (MQTTPublishOperation) has been completed
2020-04-29 08:00:13,050 - pipeline_ops_base - azure.iot.device.common.pipeline.pipeline_ops_base - DEBUG - SendD2CMessageOperation: completing without error
2020-04-29 08:00:13,050 - pipeline_thread - azure.iot.device.common.pipeline.pipeline_thread - DEBUG - Starting on_complete in callback thread
2020-04-29 08:00:13,051 - async_adapter - azure.iot.device.common.async_adapter - DEBUG - Callback completed with result None
2020-04-29 08:00:13,051 - async_clients - azure.iot.device.iothub.aio.async_clients - INFO - Successfully sent message to Hub

About this :

Even though no devices are sending any data, the message quota is seeing a lot of traffic even though no messages are beeing sent

Take care of the bad interpretation of Total number of messages used. The real value you should look at is Telemetry messages sent

FabGre
  • 135
  • 1
  • 9