Prerequisites
To follow the steps on this page:- Create a target with Real-time analytics enabled. You need your connection details. This procedure also works for .
- This example uses the SustData public dataset. This dataset tracks the power usage of a small number of apartments and houses over four different deployment intervals. The data is collected in one-minute samples from each unit.
Create a materialized view with heartbeat aggregates
When you have loaded the data into hypertables, you can create a materialized view containing weekly heartbeat aggregates for each of the units.-
Create the materialized view
heartbeat_aggtakes the following parameters: the timestamp column, the start of the interval, the length of the interval, and how long the aggregate is considered live after each timestamp. This example uses 2 minutes as the heartbeat lifetime to give some tolerance for small gaps. -
Query heartbeat data for a particular unit
You can use this data to see when you’re receiving data for a particular unit. This example rolls up the weekly
aggregates into a single aggregate using
rollup(), and then views the live ranges usinglive_ranges(): -
Construct more elaborate queries
To return the 5 units with the lowest
uptimeduring the third deployment: -
Combine aggregates from different units to get the combined coverage
This example queries the interval where any part of a deployment was active:
You can use this data to make observations and draw conclusions:
- The second deployment had a lot more problems than the other ones.
- There were some readings from February 2013 that were incorrectly categorized as a second deployment.
- The timestamps are given in a local time without time zone, resulting in some missing hours around springtime daylight savings time changes.