This guide assumes IoT Hub has been previously deployed. Otherwise follow this guide
Fill in the following parameters of src/ColdPath/ColdPathDeployment/azuredeploy.parameters.json:
clusterName: A name for the HDInsight cluster
clusterLoginUserName: an username for the HDInsight cluster
clusterLoginPassword: a password for the HDInsight cluster
IotHubName: existing IoT Hub name
IotHubResourceGroup: resource group name of the IoT Hub
cd src/ColdPath/ColdPathDeployment
az group deployment create -n <deployment-name> \
-g <resource-group> --template-file azuredeploy.json \
--parameters azuredeploy.parameters.json
Create a blob storage container named "telemetry" in the telemetry storage account created in step 1.
az storage container create --name telemetry --account-name <telemetry-storage-account-name> --account-key <telemetry-storage-access-key>
Configure IoT Hub instance with a custom Azure Storage container endpoint pointing to the cold telemetry storage container created in step 2.
Message routing -> Custom endpoints -> Add -> Blob Storage -> Select telemetry storage connainter created in step 2.
More info: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-endpoints#custom-endpoints
Configure IoT Hub instance with a default message route that sends device event messages to the default events endpoint.
az iot hub update -n <iot-hub-name> -g <iot-hub-resource-group> --add properties.routing.routes "{'condition':'true', 'endpointNames':['events'], 'isEnabled':True, 'name':'defaulteventroute', 'source':'DeviceMessages'}"
Configure IoT Hub instance with a custom route that sends device event messages to the custom storage endpoint created in step 3.
az iot hub update -n <iot-hub-name> -g <iot-hub-resource-group-name> --add properties.routing.routes "{'condition':'true', 'endpointNames':['<custom-storage-endpoint-name>'], 'isEnabled':True, 'name':'storageroute', 'source':'DeviceMessages'}"
More info: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-custom
Upload src\ColdPath\HiveApplication\HiveQueries\telemetry.avsc schema to the cold telemetry blob container created in step 2.
Note: The telemetry.avsc file was generated using the following steps:
- Download the Avro tools (http://avro.apache.org/releases.html#Download).
- Run the following command to extract the schema from a sample of the telemetry
java -jar $AVRO_TOOLS_PATH/avro-tools-1.8.2.jar getschema $SAMPLE_TELEMETRY_FILE > telemetry.avsc
Update src\ColdPath\HiveApplication\HiveQueries\createrawtelemetrytable.hql with the Azure Storage account of cold telemetry account created in step 1. Also update src\ColdPath\HiveApplication\HiveQueries\createrawtelemetrytable.hql with the IoT Hub name.
Using the Hive View of the HDInsight cluster created in step 1, run the following queries:
- createrawtelemetrytable.hql to create an external Hive table that represents the raw telemetry
- enrichtelemetry.hql to create a Hive table that enriches the data in the rawtelemetry Hive table.
- summarizedeliveries.hql to create a Hive table that summarizes the enrichedtelemetrytable by deliveryId.
Use Power BI Desktop to analyze the data in the deliverysummarytable.