diff --git a/.ci/vale/styles/InfluxDataDocs/WordList.yml b/.ci/vale/styles/InfluxDataDocs/WordList.yml index 59ab8922c..5582bd6ac 100644 --- a/.ci/vale/styles/InfluxDataDocs/WordList.yml +++ b/.ci/vale/styles/InfluxDataDocs/WordList.yml @@ -82,6 +82,5 @@ swap: tablename: table name tablet: device touch: tap - url: URL vs\.: versus World Wide Web: web diff --git a/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt b/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt index 5eb80d548..2d1e152a6 100644 --- a/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt +++ b/.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt @@ -72,6 +72,8 @@ quoteChar retentionRules sourceBucket tagKey +`url[s]?` +URL v2 v3 venv diff --git a/.lintstagedrc.mjs b/.lintstagedrc.mjs index c88b4ac20..31c075721 100644 --- a/.lintstagedrc.mjs +++ b/.lintstagedrc.mjs @@ -34,6 +34,13 @@ function pytestStagedContent(paths, productPath) { `docker build . -f Dockerfile.pytest -t influxdata-docs/pytest:latest`, + + + // Create a Docker volume for temporary files generated during testing + `sh -c "docker volume create \ + --label tag=influxdata-docs \ + --label stage=test \ + --name test-tmp || true"`, // Run test runners. // Uses a pytest plugin to suppress exit code 5 (if no tests are found), @@ -49,6 +56,7 @@ function pytestStagedContent(paths, productPath) { --env-file ${productPath}/.env.test \ --volumes-from ${CONTENT} \ --mount type=bind,src=./test/shared,dst=/shared \ + --mount type=volume,source=test-tmp,target=/app/iot-starter \ influxdata-docs/pytest --codeblocks --suppress-no-test-exit-code --exitfirst ${productPath}/`, ]; } diff --git a/content/influxdb/clustered/get-started/write.md b/content/influxdb/clustered/get-started/write.md index 7c6b31ef7..fa3150f9b 100644 --- a/content/influxdb/clustered/get-started/write.md +++ b/content/influxdb/clustered/get-started/write.md @@ -204,32 +204,32 @@ influxctl write \ --database get-started \ --token $INFLUX_TOKEN \ --precision s \ - 'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 -home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 -home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 -home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 -home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200 -home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200 -home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800 -home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800 -home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400 -home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400 -home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000 -home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000 -home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600 -home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600 -home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200 -home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200 -home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800 -home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800 -home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400 -home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400 -home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000 -home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000 -home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600 -home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 -home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 -home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200' + 'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400 +home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400 +home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000 +home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000 +home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600 +home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600 +home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200 +home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200 +home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800 +home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800 +home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400 +home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400 +home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000 +home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000 +home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600 +home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600 +home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200 +home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200 +home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800 +home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800 +home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400 +home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400 +home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000 +home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000 +home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600 +home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600' ``` {{% /code-placeholders %}} @@ -258,47 +258,48 @@ and then write it to {{< product-name >}}. ```sh cat <<- EOF > home.lp - home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 - home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 - home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 - home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 - home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200 - home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200 - home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800 - home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800 - home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400 - home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400 - home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000 - home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000 - home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600 - home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600 - home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200 - home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200 - home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800 - home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800 - home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400 - home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400 - home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000 - home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000 - home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600 - home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 - home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 - home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200 + home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719820800 + home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719820800 + home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719824400 + home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719824400 + home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719828000 + home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719828000 + home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719831600 + home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719831600 + home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719835200 + home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719835200 + home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719838800 + home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719838800 + home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719842400 + home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719842400 + home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719846000 + home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719846000 + home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719849600 + home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719849600 + home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719853200 + home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719853200 + home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719856800 + home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719856800 + home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719860400 + home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719860400 + home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719864000 + home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719864000 EOF ``` 3. Run the following command to generate a Telegraf configuration file - (`./telegraf.conf`) that enables the `inputs.file` and `outputs.influxdb_v2` + (`telegraf.conf`) that enables the `inputs.file` and `outputs.influxdb_v2` plugins: ```sh - telegraf --sample-config \ + mkdir -p iot-project \ + && telegraf --sample-config \ --input-filter file \ --output-filter influxdb_v2 \ - > telegraf.conf + > iot-project/telegraf.conf ``` -4. In your editor, open `./telegraf.conf` and configure the following: +4. In your editor, open `iot-project/telegraf.conf` and configure the following: - **`file` input plugin**: In the `[[inputs.file]].files` list, replace `"/tmp/metrics.out"` with your sample data filename. If Telegraf can't @@ -309,12 +310,28 @@ and then write it to {{< product-name >}}. ## Files to parse each interval. Accept standard unix glob matching rules, ## as well as ** to match recursive files and directories. files = ["home.lp"] + # Set the timestamp precision to the precision in your data. + influx_timestamp_precision = '1s' + ## Optionally, use the newer, more efficient line protocol parser + influx_parser_type = 'upstream' ``` @@ -338,15 +355,20 @@ and then write it to {{< product-name >}}. ``` @@ -367,7 +389,7 @@ and then write it to {{< product-name >}}. Enter the following command in your terminal: ```sh - telegraf --once --config ./telegraf.conf + telegraf --once --config iot-project/telegraf.conf ``` If the write is successful, the output is similar to the following: @@ -445,32 +467,32 @@ response=$(curl --silent --write-out "%{response_code}:-%{errormsg}" \ --header "Content-type: text/plain; charset=utf-8" \ --header "Accept: application/json" \ --data-binary " -home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 -home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 -home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 -home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 -home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200 -home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200 -home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800 -home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800 -home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400 -home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400 -home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000 -home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000 -home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600 -home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600 -home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200 -home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200 -home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800 -home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800 -home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400 -home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400 -home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000 -home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000 -home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600 -home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 -home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 -home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200 +home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400 +home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400 +home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000 +home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000 +home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600 +home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600 +home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200 +home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200 +home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800 +home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800 +home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400 +home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400 +home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000 +home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000 +home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600 +home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600 +home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200 +home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200 +home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800 +home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800 +home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400 +home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400 +home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000 +home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000 +home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600 +home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600 ") # Format the response code and error message output. @@ -556,32 +578,32 @@ response=$(curl --silent --write-out "%{response_code}:-%{errormsg}" \ --header "Content-Type: text/plain; charset=utf-8" \ --header "Accept: application/json" \ --data-binary " -home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000 -home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000 -home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600 -home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600 -home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200 -home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200 -home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800 -home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800 -home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400 -home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400 -home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000 -home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000 -home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600 -home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600 -home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200 -home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200 -home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800 -home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800 -home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400 -home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400 -home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000 -home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000 -home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600 -home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600 -home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200 -home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200 +home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400 +home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400 +home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000 +home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000 +home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600 +home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600 +home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200 +home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200 +home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800 +home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800 +home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400 +home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400 +home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000 +home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000 +home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600 +home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600 +home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200 +home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200 +home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800 +home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800 +home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400 +home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400 +home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000 +home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000 +home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600 +home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600 ") # Format the response code and error message output. diff --git a/test/src/requirements.txt b/test/src/requirements.txt index 7d366d868..788173c44 100644 --- a/test/src/requirements.txt +++ b/test/src/requirements.txt @@ -7,6 +7,7 @@ pytest-dotenv>=0.5.2 # Allow pytest to pass if no tests (i.e. testable code blocks) are found. pytest-custom-exit-code>=0.3.0 requests>=2.26.0 +toml # Code sample dependencies influxdb3-python @ git+https://github.com/InfluxCommunity/influxdb3-python@v0.5.0 influxdb3-python-cli @ git+https://github.com/InfluxCommunity/influxdb3-python-cli@main