|
| 1 | +--- |
| 2 | +title: Detect anomalies at the edge in an Azure solution tutorial | Microsoft Docs |
| 3 | +description: In this tutorial you learn how to monitor your IoT Edge devices using the Remote Monitoring solution accelerator. |
| 4 | +author: dominicbetts |
| 5 | +manager: timlt |
| 6 | +ms.author: dobett |
| 7 | +ms.service: iot-accelerators |
| 8 | +services: iot-accelerators |
| 9 | +ms.date: 10/12/2018 |
| 10 | +ms.topic: tutorial |
| 11 | +ms.custom: mvc |
| 12 | + |
| 13 | +# As an operator of an IoT monitoring solution, I want to detect anomalies at the edge in order to reduce the volume of telemetry sent to my Remote Monitoring solution and to respond quickly to those anomalies. |
| 14 | +--- |
| 15 | + |
| 16 | +# Tutorial: Detect anomalies at the edge with the Remote Monitoring solution accelerator |
| 17 | + |
| 18 | +In this tutorial, you configure the Remote Monitoring solution to respond to anomalies detected by an IoT Edge device. IoT Edge devices let you process telemetry at the edge to reduce the volume of telemetry sent to the solution and to enable faster responses to events on devices. To learn more about the benefits of edge processing, see [What is Azure IoT Edge](../iot-edge/about-iot-edge.md). |
| 19 | + |
| 20 | +To introduce edge processing with remote monitoring, this tutorial uses a simulated oil pump jack device. This oil pump jack is managed by an organization called Contoso and is connected to the Remote Monitoring solution accelerator. Sensors on the oil pump jack measure metrics such as temperature and pressure. Operators at Contoso know that an abnormal increase in temperature can cause the oil pump jack to slow down. Operators at Contoso don't need to monitor the device's temperature when it's within its normal range. |
| 21 | + |
| 22 | +Contoso wants to deploy an intelligent edge module to the oil pump jack that detects temperature anomalies. Another edge module sends alerts to the Remote Monitoring solution. When an alert is received, a Contoso operator can dispatch a maintenance technician. Contoso could also configure an automated action, such as sending an email, to run when the solution receives an alert. |
| 23 | + |
| 24 | +This tutorial uses your local Windows development machine as an IoT Edge device. You install edge modules to simulate the oil pump jack device and to detect the temperature anomalies. |
| 25 | + |
| 26 | +In this tutorial, you: |
| 27 | + |
| 28 | +>[!div class="checklist"] |
| 29 | +> * Add an IoT Edge device to the solution |
| 30 | +> * Import a package that defines the modules to run on the device |
| 31 | +> * Deploy the package to your IoT Edge device |
| 32 | +> * View alerts from the device |
| 33 | +
|
| 34 | +If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. |
| 35 | + |
| 36 | +[!INCLUDE [iot-accelerators-tutorial-prereqs](../../includes/iot-accelerators-tutorial-prereqs.md)] |
| 37 | + |
| 38 | +The tutorial uses your local Windows machine to host the IoT Edge runtime. To install the IoT Edge runtime, you must have [Docker for Windows](https://docs.docker.com/docker-for-windows/install/) installed and configured to use Linux containers. |
| 39 | + |
| 40 | +[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)] |
| 41 | + |
| 42 | +## Add an IoT Edge device |
| 43 | + |
| 44 | +There are two steps to add an IoT Edge device to your Remote Monitoring solution accelerator. This section shows you how to use: |
| 45 | + |
| 46 | +* Add an IoT Edge device on the **Devices** page in the Remote Monitoring web UI. |
| 47 | +* Windows Powershell to install the IoT Edge runtime on your local Windows device. |
| 48 | + |
| 49 | +### Add an IoT Edge device to your solution |
| 50 | + |
| 51 | +To add an IoT Edge device to the Remote Monitoring solution accelerator, navigate to the **Devices** page in the web UI and click **+ New device**. |
| 52 | + |
| 53 | +In the **New device** panel, choose **IoT Edge device**. You can leave the default values for the other settings. The click **Apply**: |
| 54 | + |
| 55 | +[](./media/iot-accelerators-remote-monitoring-edge/addedgedevice-expanded.png#lightbox) |
| 56 | + |
| 57 | +Make a note of the device connection string, you need it later in this tutorial. |
| 58 | + |
| 59 | +When you register a device with the IoT hub in the Remote Monitoring solution accelerator, it's listed on the **Devices** page in the web UI: |
| 60 | + |
| 61 | +[](./media/iot-accelerators-remote-monitoring-edge/newedgedevice-expanded.png#lightbox) |
| 62 | + |
| 63 | +To make it easier to manage the IoT Edge devices in the solution, create a device group and add the IoT Edge device: |
| 64 | + |
| 65 | +1. On the **Devices** page, click **Manage device groups**. |
| 66 | +1. Click **Add new device group**. Create a new device group with the following settings: |
| 67 | + |
| 68 | + | Setting | Value | |
| 69 | + | ------- | ----- | |
| 70 | + | Name | EdgeDevices | |
| 71 | + | Field | Tags.IsEdge | |
| 72 | + | Operator | = Equals | |
| 73 | + | Value | Y | |
| 74 | + | Type | Text | |
| 75 | + |
| 76 | +1. Click **Save**. |
| 77 | +1. Select the **MyRMEdgeDevice** device in the list on the **Devices** page and then click **Jobs**. |
| 78 | +1. Create a job to add the **IsEdge** tag to the device using the following settings: |
| 79 | + |
| 80 | + | Setting | Value | |
| 81 | + | ------- | ----- | |
| 82 | + | Job | Tag | |
| 83 | + | Job Name | AddEdgeTag | |
| 84 | + | Key | IsEdge | |
| 85 | + | Value | Y | |
| 86 | + |
| 87 | +1. Click **Apply**. |
| 88 | + |
| 89 | +You IoT Edge device is now in the **EdgeDevices** group. |
| 90 | + |
| 91 | +### Install the Edge runtime |
| 92 | + |
| 93 | +An Edge device requires the Edge runtime to be installed. In this tutorial, you install the Edge runtime on your local Windows computer to test the scenario. |
| 94 | + |
| 95 | +1. Make sure that Docker is running on your local Windows machine. |
| 96 | +1. Open an elevated PowerShell prompt on your local machine. Installing the IoT Edge runtime requires administrative permissions. |
| 97 | +1. Run the following PowerShell command to install the IoT Edge runtime: |
| 98 | + |
| 99 | + ```PowerShell |
| 100 | + . {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; ` |
| 101 | + Install-SecurityDaemon -Manual -ContainerOs Linux |
| 102 | + ``` |
| 103 | +
|
| 104 | +1. When prompted, use the device connection string you made a note of previously. |
| 105 | +
|
| 106 | +1. Use the following PowerShell commands to verify the IoT Edge is running: |
| 107 | +
|
| 108 | + ```PowerShell |
| 109 | + Get-Service iotedge |
| 110 | + iotedge list |
| 111 | + ``` |
| 112 | +
|
| 113 | + If the runtime started correctly, you see the **edgeHub** and **edgeAgent** processes have a status of **running**. |
| 114 | +
|
| 115 | +## Import a package |
| 116 | +
|
| 117 | +## Deploy a package |
| 118 | +
|
| 119 | +## Monitor the device |
| 120 | +
|
| 121 | +## Next steps |
| 122 | +
|
| 123 | +This tutorial showed you how add and configure an IoT Edge device in the Remote Monitoring solution accelerator. To learn more about working with IoT Edge packages in the Remote Monitoring solution, see the following how-to guide: |
| 124 | +
|
| 125 | +> [!div class="nextstepaction"] |
| 126 | +> [Import an IoT Edge package into your Remote Monitoring solution accelerator](iot-accelerators-remote-monitoring-import-edge-package.md) |
0 commit comments