Documentation

sample.data() function

The sample.data() function downloads and outputs an InfluxDB sample dataset.

import "influxdata/influxdb/sample"

sample.data(
  set: "airSensor"
)

Network bandwidth

Each execution of sample.data() downloads the specified dataset from Amazon S3. If using InfluxDB Cloud or a hosted InfluxDB OSS instance, you may see additional network bandwidth costs when using this function. Approximate sample dataset sizes are listed below and in the output of sample.list().

Available InfluxDB sample datasets

airSensor

Simulated office building air sensor data with temperature, humidity, and carbon monoxide metrics.

Size: ~600 KB • Updated: every 15m

birdMigration

2019 African bird migration data from the Movebank: Animal Tracking dataset. Contains geotemporal data between 2019-01-01 and 2019-12-31.

Size: ~1.2 MB • Updated: N/A

noaa

Latest observations from the NOAA National Data Buoy Center (NDBC). Contains only the most recent observations (no historical data). Data is updated approximately every 15m.

Size: ~1.3 MB • Updated: every 15m

usgs

USGS earthquake data from the last week. Contains geotemporal data collected from USGS seismic sensors around the world. Data is updated approximately every 15m.

Size: ~6 MB • Updated: every 15m

Parameters

set

(Required) InfluxDB sample dataset to download and output.

Valid values:

  • airSensor
  • birdMigration
  • noaa
  • usgs

Examples

Return USGS earthquake data from the last week
import "influxdata/influxdb/sample"

sample.data(set: "usgs")
Download and write NOAA NDBC data to InfluxDB

Add the following as an InfluxDB task to regularly collect the latest reported observations from the NOAA NDBC.

import "influxdata/influxdb/sample"

option task = {
  name: "Collect NOAA NDBC data"
  every: 15m,
}

sample.data(set: "noaa")
  |> to(
      org: "example-org",
      bucket: "example-bucket"
  )

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.