|
1 | 1 | ---
|
2 | 2 | title: Monitor Azure IoT Hub
|
3 | 3 | description: Start here to learn how to monitor Azure IoT Hub by using Azure Monitor. Learn about the types of monitoring data you can collect and ways to analyze that data.
|
4 |
| -ms.date: 06/26/2024 |
| 4 | +ms.date: 07/15/2024 |
5 | 5 | ms.custom: horz-monitor, subject-monitoring
|
6 | 6 | ms.topic: conceptual
|
7 | 7 | author: kgremban
|
@@ -62,6 +62,18 @@ The information presented on the **Overview pane** is useful, but represents onl
|
62 | 62 |
|
63 | 63 | [!INCLUDE [horz-monitor-resource-logs](~/reusable-content/ce-skilling/azure/includes/azure-monitor/horizontals/horz-monitor-resource-logs.md)]
|
64 | 64 |
|
| 65 | +### Route connection events to logs |
| 66 | + |
| 67 | +IoT hub continuously emits resource logs for several categories of operations. To collect this log data, though, you need to create a diagnostic setting to route it to a destination where it can be analyzed or archived. One such destination is Azure Monitor Logs via a Log Analytics workspace ([see pricing](https://azure.microsoft.com/pricing/details/log-analytics/)), where you can analyze the data using Kusto queries. |
| 68 | + |
| 69 | +The IoT Hub [resource logs connections category](monitor-iot-hub-reference.md#connections-category) emits operations and errors having to do with device connections. The following screenshot shows a diagnostic setting to route these logs to a Log Analytics workspace: |
| 70 | + |
| 71 | +:::image type="content" source="media/iot-hub-troubleshoot-connectivity/create-diagnostic-setting.png" alt-text="Recommended setting to send connectivity logs to Log Analytics workspace."::: |
| 72 | + |
| 73 | +We recommend creating a diagnostic setting as early as possible after you create your IoT hub, because, although IoT Hub always emits resource logs, Azure Monitor doesn't collect them until you route them to a destination. |
| 74 | + |
| 75 | +To learn more about routing logs to a destination, see [Collection and routing](monitor-iot-hub.md#collection-and-routing). For detailed instructions to create a diagnostic setting, see the [Use metrics and logs tutorial](tutorial-use-metrics-and-diags.md). |
| 76 | + |
65 | 77 | [!INCLUDE [horz-monitor-activity-log](~/reusable-content/ce-skilling/azure/includes/azure-monitor/horizontals/horz-monitor-activity-log.md)]
|
66 | 78 |
|
67 | 79 | ### Analyzing logs
|
@@ -277,12 +289,20 @@ Use the following Kusto queries to help you monitor your IoT hub.
|
277 | 289 |
|
278 | 290 | ### IoT Hub alert rules
|
279 | 291 |
|
280 |
| -The following table lists some suggested alert rules for IoT Hub. These alerts are just examples. You can set alerts for any metric, log entry, or activity log entry listed in the [IoT Hub monitoring data reference](monitor-iot-hub-reference.md). |
| 292 | +You can set alerts for any metric, log entry, or activity log entry listed in the [IoT Hub monitoring data reference](monitor-iot-hub-reference.md). |
| 293 | +
|
| 294 | +## Set up metric alerts for device disconnects |
| 295 | +
|
| 296 | +You can set up alerts based on the platform metrics emitted by IoT Hub. With metric alerts, you can notify individuals that a condition of interest occurred and also trigger actions that can respond to that condition automatically. |
| 297 | +
|
| 298 | +The [*Connected devices (preview)*](monitor-iot-hub-reference.md#device-metrics) metric tells you how many devices are connected to your IoT Hub. You can create alerts to trigger if this metric drops below a threshold value: |
| 299 | +
|
| 300 | +:::image type="content" source="media/iot-hub-troubleshoot-connectivity/configure-alert-logic.png" alt-text="Alert logic settings for connected devices metric."::: |
| 301 | +
|
| 302 | +You can use metric alert rules to monitor for device disconnect anomalies at-scale. That is, use alerts to determine when a significant number of devices unexpectedly disconnect. When this situation is detected, you can look at logs to help troubleshoot the issue. To monitor per-device disconnects and disconnects for critical devices in near real time, however, you must use Event Grid. |
| 303 | +
|
| 304 | +To learn more about alerts with IoT Hub, see [Alerts in Monitor IoT Hub](monitor-iot-hub.md#alerts). For a walk-through of creating alerts in IoT Hub, see the [Use metrics and logs tutorial](tutorial-use-metrics-and-diags.md). For a more detailed overview of alerts, see [Overview of alerts in Microsoft Azure](../azure-monitor/alerts/alerts-overview.md) in the Azure Monitor documentation. |
281 | 305 |
|
282 |
| -| Alert type | Condition | Description | |
283 |
| -|:---|:---|:---| |
284 |
| -| | | | |
285 |
| -| | | | |
286 | 306 |
|
287 | 307 | [!INCLUDE [horz-monitor-advisor-recommendations](~/reusable-content/ce-skilling/azure/includes/azure-monitor/horizontals/horz-monitor-advisor-recommendations.md)]
|
288 | 308 |
|
|
0 commit comments