1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Configuring Health Monitoring for Azure IoT

Metrics & Diagnostics for IoT Edge

Start course
Overview
Difficulty
Intermediate
Duration
54m
Students
32
Ratings
5/5
starstarstarstarstar
Description

This course will focus on the skills needed to integrate Azure Monitor and its corresponding features within IoT solutions. Each service within a given IoT solution has the ability to produce metrics, logging, and alerting data. How are you going to gather all of that information and make it available to users that are managing and maintaining your solutions? This course will provide the answers to that question!

Learning Objectives

  • Understand the different metrics and diagnostics that can be retrieved from the Azure IoT Hub
  • Learn how to configure the IoT Hub for scaling programmatically
  • Learn how to query and visualize the data that is stored in Azure Monitor
  • Define specific Azure policies for your IoT Hub so that the hub meets your requirements
  • Learn how to gather metrics and diagnostics from IoT Edge

Intended Audience

  • Developers
  • Operational engineers
  • Cloud architects
  • Anyone responsible for deploying IoT solutions on Azure

Prerequisites

To get the most out of this course, you should have a strong understanding of the available IoT services that Microsoft provides, as well as a strong understanding of Azure Monitor and the different types of data that can be retrieved through all of its features and services.

Transcript

Hi there. In our last video of the series, we're going to be focusing on the IoT Edge. And IoT Edge you can think of primarily as your Edge devices. You're gonna be using Microsoft designed modules or development kits that you'll then install into some particular hardware device. When those devices are out there in the field, you wanna make sure that they're working just as well as the IOT Hub that we've been focusing on throughout the rest of the course.

So how can we actually get metrics and diagnostics from those Edge devices based on the software that you've installed? From a metrics perspective, the list of metrics is way too long for me to even put onto a single slide. Here is the URL inside of the Azure documentation that gives the entire list. Now, one note is that in order for you to actually feed metrics from your devices into Azure Monitor's metrics interface, you do need to have the metrics module installed on your devices for this to work appropriately.

Now, real quickly, let me exactly show you the list of available metrics that you can pull. Here is that documentation page that I was just showing you on the slide. And this is just the first listing here, and I'll show you really quickly, you can see messages received, messages sent. Both of those are totals. You can also get them based off of twin modules. You can get twin duration in seconds. You can get Edge Hub message send duration, all kinds of different pieces of data. And just to kind of give you an idea, this is the start of the table, and there's the bottom of the table. The list is extremely large, thereby giving you an opportunity to get numerous data points about your particular devices.

Now, when it comes to logs, your devices absolutely are gonna be producing logs as well. Primarily those logs are gonna be generated from the different modules that you install on the devices. So how exactly are you gonna get those logs? Well, there's two different ways that you can handle logs. One is you can actually feed the log data directly into Azure Cloud Shell or into the web interface that's available in the Azure portal for you to actually see that log data. This is the example of the way to use the get module logs function that you can then pull all of the logs from a specific device based off a device ID and the specific IoT Hub that it's been connected to. This will then feed that log data directly into either the Azure CLI or you can actually use this, as I mentioned, in a portal interface as well.

Here's that portal interface that I talked about. And as you can see right here at the top, it is using the get method logs. It's basically making a rest API call called GetMethodLogs. It passes the JSON document to determine the filter. For example, in this case, it's telling it to only return the last 10 messages. And then at the very bottom, you can see the result which is a status 200 letting you know that it was a successful process and that it did, in fact, retrieve those logs appropriately. Now, what happens when you wanna be able to push those logs into a storage location, just like you do with Azure diagnostics? Well, that's when you use the upload logs function. And here's an example of uploading your logs from a specific device ID again, into a full path URL of a storage account, but because it accepts a URL, you could also leverage a WSS3 or even a Google storage location, as long as you can pass in a SAS URL that will allow a upload function.

Then what will happen is the logs, each one of them will be pushed into that URL, any log that's currently sitting on the device. You can also use a separate function if you want to gzip them or pull a different set of logs. There's a number of different methods. The documentation page link has been provided at the end of the slide deck. So this is how you're gonna handle diagnostic logs, which obviously is very, very different from what we looked at with respect to IOT Hub. What we looked at for metrics, on the other hand, does equate here with IoT Edge devices.

About the Author
Avatar
Brian Harrison
Cloud Architect & Cloud Engineer
Students
81
Courses
2

Brian has been working in the Cloud space for more than a decade as both a Cloud Architect and Cloud Engineer. He has experience building Application Development, Infrastructure, and AI-based architectures using many different OSS and Non-OSS based technologies. In addition to his work at Cloud Academy, he is always trying to educate customers about how to get started in the cloud with his many blogs and videos. He is currently working as a Lead Azure Engineer in the Public Sector space.