Given the following InfluxDB query executed on a Raspberry Pi collecting temperature data every minute, what will be the output?
SELECT mean("value") FROM "temperature" WHERE time > now() - 1h GROUP BY time(10m)Assume the data has consistent temperature readings every minute for the last hour.
Think about how GROUP BY time() works in InfluxDB queries.
The query groups data into 10-minute buckets and calculates the average temperature for each bucket, so the output is a list of averages per 10-minute interval.
You want to store the Raspberry Pi CPU temperature readings in InfluxDB. Which data type should you use for the temperature field?
Temperature values can have decimal points.
CPU temperature readings are decimal numbers, so the float type is best to store precise values.
Consider this Python code snippet trying to write a temperature point to InfluxDB:
from influxdb_client import InfluxDBClient, Point
client = InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")
write_api = client.write_api()
point = Point("temperature").tag("device", "raspberry_pi").field("value", "45.3")
write_api.write(bucket="sensors", record=point)It raises a type error. What is the cause?
Check the data type passed to the field method.
The field method expects a numeric type for measurement values. Passing a string causes a type error.
Choose the correct Flux query to get the maximum temperature per hour from the "temperature" measurement.
aggregateWindow is used to group data by time intervals and apply aggregation.
Option A correctly uses aggregateWindow with max function to get max temperature per hour.
You run this Python code on your Raspberry Pi to write temperature data points to InfluxDB:
from influxdb_client import InfluxDBClient, Point
client = InfluxDBClient(url="http://localhost:8086", token="token", org="org")
write_api = client.write_api()
data = [
Point("temperature").field("value", 20.1).tag("device", "pi1"),
Point("temperature").field("value", 21.3).tag("device", "pi2"),
Point("temperature").field("value", 19.8).tag("device", "pi1"),
Point("humidity").field("value", 55).tag("device", "pi1")
]
write_api.write(bucket="sensors", record=data)How many points are stored in the "sensors" bucket?
Each Point object represents one data point.
There are 4 Point objects in the list, so 4 points are written to the bucket.