Skip to content

Recipes

Short jobs that combine the chapters. Each was either run in the lab or is assembled entirely from steps the lab ran; the transcripts are named where a recipe is a lab run retold.

Correct a wrong reading

A sensor misreports; the value in the bucket is wrong. There is no UPDATE in InfluxDB — there is the same point, written again. Write the corrected value with the same measurement, tag set and timestamp as the bad point, and it replaces it exactly (chapter 2's identity rule; the lab relied on this when its test point was written three times and counted once):

echo 'weather,station=rooftop-1 temperature=18.4,humidity=56i 1793499960' \
  | influx write --bucket weather --precision s

Then prove the correction with the chapter 5 raw query for that station and moment. Correcting without the proof is just a second opinion stored in the same place as the first.

Delete points you should not have kept

Deletion is by time range plus a predicate — there is no deleting "that one point" by pointing at it, so aim with both. The lab wrote a throwaway point, watched it exist, and removed every point from its station inside a two-hour window (transcript t09-delete.txt):

influx delete --bucket weather \
  --start 2026-11-01T02:18:47Z --stop 2026-11-01T04:18:47Z \
  --predicate 'station="throwaway"'

The confirming query afterwards returned no tables at all, exit 0. Empty output is the success message for a delete — check it with the same query that showed the data a moment before, never by trusting the delete's silence. Predicates can combine measurement, tags and fields with AND; keep them narrower than your certainty.

Give a dashboard its own key

For any program that only displays data, mint the chapter 7 pattern: one token, read-only, one bucket. The dashboard's config then names that token and nothing else, and a leak of the dashboard's configuration leaks a key to exactly one room:

influx auth create --org example-org \
  --description 'hallway display (read weather)' \
  --read-bucket 4ed5a2165acd01fe

(Find your bucket's ID in influx bucket ls.) Revoke it the day the display comes off the wall.

The one-year weather station

The standing arrangement chapters 6 and 9 were building towards, assembled:

  1. weather bucket, retention 30d — raw readings, a month of them.
  2. A task like the lab's, every: 1h, writing ten-minute means into weather-hourly, retention 365d.
  3. A second task, daily, writing daily means and maxima into weather-daily, retention infinite.

Raw questions stay askable for a month, seasonal questions for a year, and climate questions forever — at a total size smaller than a month of raw data alone. Every element of this is a step the guide ran; only their combination is new, and it is offered as assembly, not as a lab result.

Feed it from a script you already have

Anything that can print a line can feed InfluxDB: format the reading as line protocol and post it with chapter 8's curl, or pipe it to influx write with stdin as the deliberate input — the one case where the chapter 4 stdin behaviour is the feature:

printf 'weather,station=rooftop-1 temperature=%s,humidity=%si %s\n' \
  "$TEMP" "$HUM" "$(date +%s)" \
  | influx write --bucket weather --precision s

Give the script a scoped write token for that one bucket (--write-bucket), not the operator token — chapter 7's rules apply to your own scripts first of all.