You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-edge/how-to-access-built-in-metrics.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
2
title: Access built-in metrics in Azure IoT Edge
3
-
description: Remote access to built-in metrics from the IoT Edge runtime components
3
+
description: Access built-in metrics from IoT Edge runtime components to monitor device health.
4
+
#customer intent: As a system administrator, I want to access built-in metrics in Azure IoT Edge so that I can monitor and understand the health of my IoT Edge devices.
4
5
author: PatAltimore
5
-
6
6
ms.author: patricka
7
-
ms.date: 04/08/2024
8
-
ms.topic: conceptual
7
+
ms.date: 05/08/2025
8
+
ms.topic: concept-article
9
9
ms.reviewer: veyalla
10
10
ms.service: azure-iot-edge
11
11
services: iot-edge
@@ -17,11 +17,11 @@ services: iot-edge
17
17
18
18
The IoT Edge runtime components, IoT Edge hub, and IoT Edge agent, produce built-in metrics in the [Prometheus exposition format](https://prometheus.io/docs/instrumenting/exposition_formats/). Access these metrics remotely to monitor and understand the health of an IoT Edge device.
19
19
20
-
You can use your own solution to access these metrics. Or, you can use the [metrics-collector module](https://mcr.microsoft.com/artifact/mar/azureiotedge-metrics-collector), which handles collecting the built-in metrics and sending them to Azure Monitor or Azure IoT Hub. For more information, see [Collect and transport metrics](how-to-collect-and-transport-metrics.md).
20
+
Use your own solution to access these metrics, or use the [metrics-collector module](https://mcr.microsoft.com/artifact/mar/azureiotedge-metrics-collector), which collects the built-in metrics and sends them to Azure Monitor or Azure IoT Hub. For more information, see [Collect and transport metrics](how-to-collect-and-transport-metrics.md).
21
21
22
-
Metrics are automatically exposed by default on **port 9600** of the **edgeHub** and **edgeAgent** modules (`http://edgeHub:9600/metrics` and `http://edgeAgent:9600/metrics`). They aren't port mapped to the host by default.
22
+
Metrics are exposed by default on **port 9600** of the **edgeHub** and **edgeAgent** modules (`http://edgeHub:9600/metrics` and `http://edgeAgent:9600/metrics`). They aren't mapped to the host by default.
23
23
24
-
Access metrics from the host by exposing and mapping the metrics port from the module's `createOptions`. The example below maps the default metrics port to port 9601 on the host:
24
+
Access metrics from the host by exposing and mapping the metrics port in the module's `createOptions`. The following example maps the default metrics port to port 9601 on the host:
25
25
26
26
```json
27
27
{
@@ -40,36 +40,36 @@ Access metrics from the host by exposing and mapping the metrics port from the m
40
40
}
41
41
```
42
42
43
-
Choose different and unique host port numbers if you are mapping both the edgeHub and edgeAgent's metrics endpoints.
43
+
Choose different and unique host port numbers when mapping both the edgeHub and edgeAgent metrics endpoints.
44
44
45
45
> [!NOTE]
46
-
> The environment variable `httpSettings__enabled`should not be set to `false` for built-in metrics to be available for collection.
46
+
> The environment variable `httpSettings__enabled`must not be set to `false` for built-in metrics to be available for collection.
47
47
>
48
48
> Environment variables that can be used to disable metrics are listed in the [azure/iotedge repo doc](https://github.com/Azure/iotedge/blob/main/doc/EnvironmentVariables.md).
49
49
50
50
## Available metrics
51
51
52
-
Metrics contain tags to help identify the nature of the metric being collected. All metrics contain the following tags:
52
+
Metrics include tags that identify the nature of the metric being collected. All metrics include the following tags:
53
53
54
54
| Tag | Description |
55
55
|-|-|
56
-
| iothub | The hub the device is talking to|
56
+
| iothub | The hub the device communicates with|
57
57
| edge_device | The ID of the current device |
58
58
| instance_number | A GUID representing the current runtime. On restart, all metrics are reset. This GUID makes it easier to reconcile restarts. |
59
59
60
-
In the Prometheus exposition format, there are four core metric types: counter, gauge, histogram, and summary. For more information about the different metric types, see the [Prometheus metric types documentation](https://prometheus.io/docs/concepts/metric_types/).
60
+
The Prometheus exposition format includes four core metric types: counter, gauge, histogram, and summary. For more information about the different metric types, see the [Prometheus metric types documentation](https://prometheus.io/docs/concepts/metric_types/).
61
61
62
-
The quantiles provided for the built-in histogram and summary metrics are 0.1, 0.5, 0.9 and 0.99.
62
+
The quantiles for the built-in histogram and summary metrics are 0.1, 0.5, 0.9, and 0.99.
63
63
64
-
The **edgeHub** module produces the following metrics:
64
+
The **edgeHub** module generates the following metrics:
65
65
66
66
| Name | Dimensions | Description |
67
67
|-|-|-|
68
68
|`edgehub_gettwin_total`|`source` (operation source)<br> `id` (module ID) | Type: counter<br> Total number of GetTwin calls |
69
69
|`edgehub_messages_received_total`|`route_output` (output that sent message)<br> `id`| Type: counter<br> Total number of messages received from clients |
70
70
|`edgehub_messages_sent_total`|`from` (message source)<br> `to` (message destination)<br>`from_route_output`<br> `to_route_input` (message destination input)<br> `priority` (message priority to destination) | Type: counter<br> Total number of messages sent to clients or upstream<br> `to_route_input` is empty when `to` is $upstream |
|`edgehub_message_size_bytes`|`id`<br> | Type: summary<br> Message size from clients<br> Values may be reported as `NaN` if no new measurements are reported for a certain period of time (currently 10 minutes); for`summary` type, corresponding `_count` and `_sum` counters are emitted. |
72
+
|`edgehub_message_size_bytes`|`id`<br> | Type: summary<br> Message size from clients<br> Values might be reported as `NaN` if no new measurements are reported for 10 minutes. For the`summary` type, corresponding `_count` and `_sum` counters are emitted. |
73
73
|`edgehub_gettwin_duration_seconds`|`source` <br> `id`| Type: summary<br> Time taken for get twin operations |
74
74
|`edgehub_message_send_duration_seconds`|`from`<br> `to`<br> `from_route_output`<br> `to_route_input`| Type: summary<br> Time taken to send a message |
75
75
|`edgehub_message_process_duration_seconds`|`from` <br> `to` <br> `priority`| Type: summary<br> Time taken to process a message from the queue |
@@ -84,7 +84,7 @@ The **edgeHub** module produces the following metrics:
84
84
|`edgehub_operation_retry_total`|`id`<br> `operation` (operation name) | Type: counter<br> Total number of times edgeHub operations were retried |
85
85
|`edgehub_client_connect_failed_total`|`id` <br> `reason` (not authenticated)<br> | Type: counter<br> Total number of times clients failed to connect to edgeHub |
86
86
87
-
The **edgeAgent** module produces the following metrics:
87
+
The **edgeAgent** module generates the following metrics:
88
88
89
89
| Name | Dimensions | Description |
90
90
|-|-|-|
@@ -109,7 +109,7 @@ The **edgeAgent** module produces the following metrics:
109
109
|`edgeAgent_total_network_out_bytes`|`module_name`| Type: gauge<br> The number of bytes sent to network |
110
110
|`edgeAgent_total_disk_read_bytes`|`module_name`| Type: gauge<br> The number of bytes read from the disk |
111
111
|`edgeAgent_total_disk_write_bytes`|`module_name`| Type: gauge<br> The number of bytes written to disk |
112
-
|`edgeAgent_metadata`|`edge_agent_version`, `experimental_features`, `host_information`| Type: gauge<br> General metadata about the device. The value is always 0, information is encoded in the tags. Note `experimental_features` and `host_information` are json objects. `host_information` looks like ```{"OperatingSystemType": "linux", "Architecture": "x86_64", "Version": "1.2.7", "Provisioning": {"Type": "dps.tpm", "DynamicReprovisioning": false, "AlwaysReprovisionOnStartup": false}, "ServerVersion": "20.10.11+azure-3", "KernelVersion": "5.11.0-1027-azure", "OperatingSystem": "Ubuntu 20.04.4 LTS", "NumCpus": 2, "Virtualized": "yes"}```. Note `ServerVersion` is the Docker version and `Version` is the IoT Edge security daemon version. |
112
+
|`edgeAgent_metadata`|`edge_agent_version`, `experimental_features`, `host_information`| Type: gauge<br> General metadata about the device. The value is always 0, and information is encoded in the tags. Note that `experimental_features` and `host_information` are JSON objects. `host_information` looks like ```{"OperatingSystemType": "linux", "Architecture": "x86_64", "Version": "1.2.7", "Provisioning": {"Type": "dps.tpm", "DynamicReprovisioning": false, "AlwaysReprovisionOnStartup": false}, "ServerVersion": "20.10.11+azure-3", "KernelVersion": "5.11.0-1027-azure", "OperatingSystem": "Ubuntu 20.04.4 LTS", "NumCpus": 2, "Virtualized": "yes"}```. Note `ServerVersion` is the Docker version and `Version` is the IoT Edge security daemon version. |
Monitor and manage IoT Edge deployments by using the direct methods included in the IoT Edge agent module. Direct methods are implemented on the device, and then can be invoked from the cloud. The IoT Edge agent includes direct methods that help you monitor and manage your IoT Edge devices remotely.
22
+
Monitor and manage IoT Edge deployments using the direct methods in the IoT Edge agent module. Direct methods are implemented on the device and can be invoked from the cloud. The IoT Edge agent includes direct methods to monitor and manage IoT Edge devices remotely.
19
23
20
24
For more information about direct methods, how to use them, and how to implement them in your own modules, see [Understand and invoke direct methods from IoT Hub](../iot-hub/iot-hub-devguide-direct-methods.md).
21
25
22
-
The names of these direct methods are handled case-insensitive.
26
+
The names of these direct methods are caseinsensitive.
23
27
24
28
## Ping
25
29
26
-
The **ping** method is useful for checking whether IoT Edge is running on a device, or whether the device has an open connection to IoT Hub. Use this direct method to ping the IoT Edge agent and get its status. A successful ping returns an empty payload and **"status": 200**.
30
+
The **ping** method checks if IoT Edge is running on a device or if the device has an open connection to IoT Hub. Use this method to ping the IoT Edge agent and check its status. A successful ping returns an empty payload and a**"status": 200**.
In the Azure portal, invoke the method with the method name `ping` and an empty JSON payload `{}`.
38
+
In the Azure portal, invoke the method using the method name `ping` and an empty JSON payload `{}`.
35
39
36
-
:::image type="content" source="./media/how-to-edgeagent-direct-method/ping-direct-method.png" alt-text="Screenshot showing how to invoke the direct method ping in Azure portal.":::
40
+
:::image type="content" source="./media/how-to-edgeagent-direct-method/ping-direct-method.png" alt-text="Screenshot of how to invoke the direct method ping in Azure portal.":::
37
41
38
42
## Restart module
39
43
40
-
The **RestartModule** method allows for remote management of modules running on an IoT Edge device. If a module is reporting a failed state or other unhealthy behavior, you can trigger the IoT Edge agent to restart it. A successful restart command returns an empty payload and**"status": 200**.
44
+
The **RestartModule** method lets you remotely manage modules running on an IoT Edge device. If a module reports a failed state or unhealthy behavior, trigger the IoT Edge agent to restart it. A successful restart command returns an empty payload with**"status": 200**.
41
45
42
-
The RestartModule method is available in IoT Edge version 1.0.9 and later.
46
+
The RestartModule method is available starting with IoT Edge version 1.0.9.
43
47
44
48
>[!TIP]
45
-
>The IoT Edge troubleshooting page in the Azure portal provides a simplified experience for restarting modules. For more information, see [Monitor and troubleshoot IoT Edge devices from the Azure portal](troubleshoot-in-portal.md).
49
+
>The IoT Edge troubleshooting page in the Azure portal simplifies restarting modules. For more information, see [Monitor and troubleshoot IoT Edge devices from the Azure portal](troubleshoot-in-portal.md).
46
50
47
-
You can use the RestartModule direct method on any module running on an IoT Edge device, including the edgeAgent module itself. However, if you use this direct method to shut down the edgeAgent, you won't receive a success result since the connection is disrupted while the module restarts.
51
+
Use the RestartModule direct method on any module running on an IoT Edge device, including the edgeAgent module. If you use this direct method to shut down the edgeAgent, you don't receive a success result because the connection is disrupted during the module restart.
In the Azure portal, invoke the method with the method name `RestartModule`and the following JSON payload:
65
+
In the Azure portal, use the method name `RestartModule`with the following JSON payload:
62
66
63
67
```json
64
68
{
@@ -67,14 +71,14 @@ In the Azure portal, invoke the method with the method name `RestartModule` and
67
71
}
68
72
```
69
73
70
-
:::image type="content" source="./media/how-to-edgeagent-direct-method/restartmodule-direct-method.png" alt-text="Screenshot showing how to invoke direct method RestartModule in the Azure portal.":::
74
+
:::image type="content" source="./media/how-to-edgeagent-direct-method/restartmodule-direct-method.png" alt-text="Screenshot of invoking the direct method RestartModule in the Azure portal.":::
71
75
72
76
## Diagnostic direct methods
73
77
74
-
*[GetModuleLogs](how-to-retrieve-iot-edge-logs.md#retrieve-module-logs): Retrieve module logs inline in the response of the direct method.
75
-
*[UploadModuleLogs](how-to-retrieve-iot-edge-logs.md#upload-module-logs): Retrieve module logs and upload them to Azure Blob Storage.
76
-
*[UploadSupportBundle](how-to-retrieve-iot-edge-logs.md#upload-support-bundle-diagnostics): Retrieve module logs using a support bundle and upload a zip file to Azure Blob Storage.
77
-
*[GetTaskStatus](how-to-retrieve-iot-edge-logs.md#get-upload-request-status): Check on the status of an upload logs or support bundle request.
78
+
*[GetModuleLogs](how-to-retrieve-iot-edge-logs.md#retrieve-module-logs): Retrieve module logs in the response of the direct method.
79
+
*[UploadModuleLogs](how-to-retrieve-iot-edge-logs.md#upload-module-logs): Retrieve module logs and upload to Azure Blob Storage.
80
+
*[UploadSupportBundle](how-to-retrieve-iot-edge-logs.md#upload-support-bundle-diagnostics): Retrieve module logs with a support bundle and upload a zip file to Azure Blob Storage.
81
+
*[GetTaskStatus](how-to-retrieve-iot-edge-logs.md#get-upload-request-status): Check the status of an upload logs or support bundle request.
78
82
79
83
These diagnostic direct methods are available as of the 1.0.10 release.
0 commit comments