Skip to content

Commit d73e99d

Browse files
Add CLI instructions for writing sample data (#5814)
* add cli instructions for writing sample data * Apply suggestions from code review Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com> --------- Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
1 parent 43efe0c commit d73e99d

File tree

1 file changed

+121
-33
lines changed

1 file changed

+121
-33
lines changed

content/shared/influxdb3-sample-data/sample-data.md

Lines changed: 121 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,56 @@ to
4040

4141
#### Write the home sensor data to InfluxDB
4242

43-
Use the InfluxDB v2 or v1 API to write the home sensor sample data to {{< product-name >}}.
43+
Use the `influxdb3` CLI, InfluxDB v2 API, or InfluxDB v1 API to write the
44+
home sensor sample data to {{< product-name >}}.
4445

4546
{{< code-tabs-wrapper >}}
4647
{{% code-tabs %}}
48+
[influxdb3](#)
4749
[v2 API](#)
4850
[v1 API](#)
4951
{{% /code-tabs %}}
5052
{{% code-tab-content %}}
5153

54+
{{% influxdb/custom-timestamps %}}
55+
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
56+
```sh
57+
influxdb3 write \
58+
--token AUTH_TOKEN \
59+
--database DATABASE_NAME \
60+
'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
61+
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
62+
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
63+
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
64+
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
65+
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
66+
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
67+
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
68+
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
69+
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
70+
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
71+
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
72+
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
73+
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
74+
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
75+
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
76+
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
77+
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
78+
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
79+
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
80+
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
81+
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
82+
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
83+
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
84+
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
85+
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200'
86+
```
87+
{{% /code-placeholders %}}
88+
{{% /influxdb/custom-timestamps %}}
89+
90+
{{% /code-tab-content %}}
91+
{{% code-tab-content %}}
92+
5293
{{% influxdb/custom-timestamps %}}
5394
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
5495
```sh
@@ -96,7 +137,7 @@ home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
96137
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
97138
```sh
98139
curl --request POST \
99-
https://{{< influxdb/host >}}/write?db=DATABASE_NAME&precision=s \
140+
http://{{< influxdb/host >}}/write?db=DATABASE_NAME&precision=s \
100141
--header "Authorization: Bearer AUTH_TOKEN" \
101142
--header "Content-type: text/plain; charset=utf-8" \
102143
--data-binary "
@@ -139,12 +180,12 @@ Replace the following in the sample script:
139180
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
140181
the name of database to write to
141182
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
142-
your InfluxDB authorization token
183+
your {{< product-name >}} authorization token
143184

144185
> [!Note]
145186
> While in alpha, {{< product-name >}} does not require an authorization token.
146-
> You can either omit the `Authorization` header or you can provide an
147-
> arbitrary token string.
187+
> You can either omit the CLI `--token` option or the HTTP `Authorization` header or
188+
> you can provide an arbitrary token string.
148189
149190
{{% /expand %}}
150191
{{< /expand-wrapper >}}
@@ -186,21 +227,43 @@ to
186227

187228
#### Write the home sensor actions data to InfluxDB
188229

189-
Use the InfluxDB v2 or v1 API to write the home sensor actions sample data
190-
to {{< product-name >}}.
230+
Use the `influxdb3` CLI, InfluxDB v2 API, or InfluxDB v1 API to write the
231+
home sensor actions sample data to {{< product-name >}}.
191232

192233
{{< code-tabs-wrapper >}}
193234
{{% code-tabs %}}
235+
[influxdb3](#)
194236
[v2 API](#)
195237
[v1 API](#)
196238
{{% /code-tabs %}}
197239
{{% code-tab-content %}}
198240

241+
{{% influxdb/custom-timestamps %}}
242+
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
243+
```sh
244+
influxdb3 write \
245+
--token AUTH_TOKEN \
246+
--database DATABASE_NAME \
247+
'home_actions,room=Kitchen,action=cool,level=ok description="Temperature at or above 23°C (23°C). Cooling to 22°C." 1641027600
248+
home_actions,room=Kitchen,action=cool,level=ok description="Temperature at or above 23°C (23.3°C). Cooling to 22°C." 1641060000
249+
home_actions,room=Kitchen,action=cool,level=ok description="Temperature at or above 23°C (23.1°C). Cooling to 22°C." 1641063600
250+
home_actions,room=Kitchen,action=alert,level=warn description="Carbon monoxide level above normal: 18 ppm." 1641060000
251+
home_actions,room=Kitchen,action=alert,level=warn description="Carbon monoxide level above normal: 22 ppm." 1641063600
252+
home_actions,room=Kitchen,action=alert,level=warn description="Carbon monoxide level above normal: 26 ppm." 1641067200
253+
home_actions,room=Living\ Room,action=alert,level=warn description="Carbon monoxide level above normal: 14 ppm." 1641063600
254+
home_actions,room=Living\ Room,action=alert,level=warn description="Carbon monoxide level above normal: 17 ppm." 1641067200'
255+
```
256+
{{% /code-placeholders %}}
257+
{{% /influxdb/custom-timestamps %}}
258+
259+
{{% /code-tab-content %}}
260+
{{% code-tab-content %}}
261+
199262
{{% influxdb/custom-timestamps %}}
200263
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
201264
```sh
202265
curl --request POST \
203-
https://{{< influxdb/host >}}/api/v2/write?bucket=DATABASE_NAME&precision=s \
266+
http://{{< influxdb/host >}}/api/v2/write?bucket=DATABASE_NAME&precision=s \
204267
--header "Authorization: Bearer AUTH_TOKEN" \
205268
--header "Content-Type: text/plain; charset=utf-8" \
206269
--header "Accept: application/json" \
@@ -225,7 +288,7 @@ home_actions,room=Living\ Room,action=alert,level=warn description="Carbon monox
225288
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
226289
```sh
227290
curl --request POST \
228-
https://{{< influxdb/host >}}/write?db=DATABASE_NAME&precision=s \
291+
http://{{< influxdb/host >}}/write?db=DATABASE_NAME&precision=s \
229292
--header "Authorization: Bearer AUTH_TOKEN" \
230293
--header "Content-type: text/plain; charset=utf-8" \
231294
--data-binary '
@@ -250,12 +313,12 @@ Replace the following in the sample script:
250313
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
251314
the name of database to write to
252315
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
253-
your InfluxDB authorization token
316+
your {{< product-name >}} authorization token
254317

255318
> [!Note]
256319
> While in alpha, {{< product-name >}} does not require an authorization token.
257-
> You can either omit the `Authorization` header or you can provide an
258-
> arbitrary token string.
320+
> You can either omit the CLI `--token` option or the HTTP `Authorization` header or
321+
> you can provide an arbitrary token string.
259322
260323
{{% /expand %}}
261324
{{< /expand-wrapper >}}
@@ -291,16 +354,29 @@ series use cases that involve seasonality.
291354

292355
#### Write the NOAA Bay Area weather data to InfluxDB
293356

294-
Use the InfluxDB v2 or v1 API to write the NOAA Bay Area weather sample data to
295-
{{< product-name >}}.
357+
Use the `influxdb3` CLI, InfluxDB v2 API, or InfluxDB v1 API to write the
358+
NOAA Bay Area weather sample data to {{< product-name >}}.
296359

297360
{{< code-tabs-wrapper >}}
298361
{{% code-tabs %}}
362+
[influxdb3](#)
299363
[v2 API](#)
300364
[v1 API](#)
301365
{{% /code-tabs %}}
302366
{{% code-tab-content %}}
303367

368+
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
369+
```sh
370+
influxdb3 write \
371+
--token AUTH_TOKEN \
372+
--database DATABASE_NAME \
373+
"$(curl --request GET https://docs.influxdata.com/downloads/bay-area-weather.lp)"
374+
```
375+
{{% /code-placeholders %}}
376+
377+
{{% /code-tab-content %}}
378+
{{% code-tab-content %}}
379+
304380
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
305381
```sh
306382
curl --request POST \
@@ -333,12 +409,12 @@ Replace the following in the sample script:
333409
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
334410
the name of database to write to
335411
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
336-
your InfluxDB authorization token
412+
your {{< product-name >}} authorization token
337413

338414
> [!Note]
339415
> While in alpha, {{< product-name >}} does not require an authorization token.
340-
> You can either omit the `Authorization` header or you can provide an
341-
> arbitrary token string.
416+
> You can either omit the CLI `--token` option or the HTTP `Authorization` header or
417+
> you can provide an arbitrary token string.
342418
343419
{{% /expand %}}
344420
{{< /expand-wrapper >}}
@@ -378,24 +454,23 @@ The Bitcoin price sample dataset provides Bitcoin prices from
378454

379455
#### Write the Bitcoin price sample data to InfluxDB
380456

381-
Use the InfluxDB v2 or v1 API to write the Bitcoin price sample data to
382-
{{< product-name >}}.
457+
Use the `influxdb3` CLI, InfluxDB v2 API, or InfluxDB v1 API to write the
458+
Bitcoin price sample data to {{< product-name >}}.
383459

384460
{{< code-tabs-wrapper >}}
385461
{{% code-tabs %}}
462+
[influxdb3](#)
386463
[v2 API](#)
387464
[v1 API](#)
388465
{{% /code-tabs %}}
389466
{{% code-tab-content %}}
390467

391468
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
392469
```sh
393-
curl --request POST \
394-
http://{{< influxdb/host >}}/api/v2/write?bucket=DATABASE_NAME \
395-
--header "Authorization: Bearer AUTH_TOKEN" \
396-
--header "Content-Type: text/plain; charset=utf-8" \
397-
--header "Accept: application/json" \
398-
--data-binary "$(curl --request GET https://docs.influxdata.com/downloads/bitcoin.lp)"
470+
influxdb3 write \
471+
--token AUTH_TOKEN \
472+
--database DATABASE_NAME \
473+
"$(curl --request GET https://docs.influxdata.com/downloads/bitcoin.lp)"
399474
```
400475
{{% /code-placeholders %}}
401476

@@ -420,12 +495,12 @@ Replace the following in the sample script:
420495
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
421496
the name of database to write to
422497
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
423-
your InfluxDB authorization token
498+
your {{< product-name >}} authorization token
424499

425500
> [!Note]
426501
> While in alpha, {{< product-name >}} does not require an authorization token.
427-
> You can either omit the `Authorization` header or you can provide an
428-
> arbitrary token string.
502+
> You can either omit the CLI `--token` option or the HTTP `Authorization` header or
503+
> you can provide an arbitrary token string.
429504
430505
{{% /expand %}}
431506
{{< /expand-wrapper >}}
@@ -453,16 +528,29 @@ transformation functions.
453528

454529
#### Write the random number sample data to InfluxDB
455530

456-
Use the InfluxDB v2 or v1 API to write the random number sample data to
457-
{{< product-name >}}.
531+
Use the `influxdb3` CLI, InfluxDB v2 API, or InfluxDB v1 API to write the
532+
random number sample data to {{< product-name >}}.
458533

459534
{{< code-tabs-wrapper >}}
460535
{{% code-tabs %}}
536+
[influxdb3](#)
461537
[v2 API](#)
462538
[v1 API](#)
463539
{{% /code-tabs %}}
464540
{{% code-tab-content %}}
465541

542+
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
543+
```sh
544+
influxdb3 write \
545+
--token AUTH_TOKEN \
546+
--database DATABASE_NAME \
547+
"$(curl --request GET https://docs.influxdata.com/downloads/random-numbers.lp)"
548+
```
549+
{{% /code-placeholders %}}
550+
551+
{{% /code-tab-content %}}
552+
{{% code-tab-content %}}
553+
466554
{{% code-placeholders "AUTH_TOKEN|DATABASE_NAME" %}}
467555
```sh
468556
curl --request POST \
@@ -495,12 +583,12 @@ Replace the following in the sample script:
495583
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
496584
the name of database to write to
497585
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
498-
your InfluxDB authorization token
586+
your {{< product-name >}} authorization token
499587

500588
> [!Note]
501589
> While in alpha, {{< product-name >}} does not require an authorization token.
502-
> You can either omit the `Authorization` header or you can provide an
503-
> arbitrary token string.
590+
> You can either omit the CLI `--token` option or the HTTP `Authorization` header or
591+
> you can provide an arbitrary token string.
504592
505593
{{% /expand %}}
506594
{{< /expand-wrapper >}}

0 commit comments

Comments
 (0)