chore(ci): Adjusts Unix timestamps (line protocol) and query time bounds for testing
- Adjusts times for writing and querying data within a recent retention period. - Adjusts Unix timestamps (in line protocol samples) to yesterday's date. - Adjusts UTC time bounds (in queries) to today and yesterday. - Reverts mistakenly changed timestamps in clustered.pull/5505/head
parent
bb64ca32bb
commit
4e601710b1
|
@ -204,6 +204,44 @@ WHERE
|
||||||
```
|
```
|
||||||
{{% /influxdb/custom-timestamps %}}
|
{{% /influxdb/custom-timestamps %}}
|
||||||
|
|
||||||
|
<!--setup-test
|
||||||
|
```sh
|
||||||
|
curl --silent \
|
||||||
|
"https://{{< influxdb/host >}}/write?db=get-started&precision=s" \
|
||||||
|
--header "Authorization: Bearer DATABASE_TOKEN" \
|
||||||
|
--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 1719907200
|
||||||
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719907200
|
||||||
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719910800
|
||||||
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719910800
|
||||||
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719914400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719914400
|
||||||
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719918000
|
||||||
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719918000
|
||||||
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719921600
|
||||||
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719921600
|
||||||
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719925200
|
||||||
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719925200
|
||||||
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719928800
|
||||||
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719928800
|
||||||
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719932400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719932400
|
||||||
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719936000
|
||||||
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719936000
|
||||||
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719939600
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719939600
|
||||||
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719943200
|
||||||
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719943200
|
||||||
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719946800
|
||||||
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719946800
|
||||||
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719950400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719950400
|
||||||
|
"
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Some examples in this getting started tutorial assume your InfluxDB
|
Some examples in this getting started tutorial assume your InfluxDB
|
||||||
credentials (**URL** and **token**) are provided by
|
credentials (**URL** and **token**) are provided by
|
||||||
|
@ -252,6 +290,16 @@ influxctl query \
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
{{% /influxdb/custom-timestamps %}}
|
{{% /influxdb/custom-timestamps %}}
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
#### Query using stored credentials
|
||||||
|
|
||||||
|
Optionally, you can configure `database` and `token` query credentials in your `influxctl`
|
||||||
|
[connection profile](/influxdb/clustered/reference/cli/influxctl/#create-a-configuration-file).
|
||||||
|
|
||||||
|
The `--database` and `--token` command line flags override credentials in your
|
||||||
|
configuration file.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
<!--------------------------- END influxctl CONTENT --------------------------->
|
<!--------------------------- END influxctl CONTENT --------------------------->
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
|
|
@ -35,8 +35,10 @@ the simplicity of SQL.
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
The examples in this section of the tutorial query the
|
The examples in this section of the tutorial query the
|
||||||
[**get-started** database](/influxdb/clustered/get-started/setup/#create-a-database) for data written in the
|
[**get-started** database](/influxdb/clustered/get-started/setup/#create-a-database)
|
||||||
[Get started writing data](/influxdb/clustered/get-started/write/#write-line-protocol-to-influxdb) section.
|
for data written in the
|
||||||
|
[Get started writing data](/influxdb/clustered/get-started/write/#write-line-protocol-to-influxdb)
|
||||||
|
section.
|
||||||
{{% /note %}}
|
{{% /note %}}
|
||||||
|
|
||||||
## Tools to execute queries
|
## Tools to execute queries
|
||||||
|
@ -202,6 +204,44 @@ WHERE
|
||||||
```
|
```
|
||||||
{{% /influxdb/custom-timestamps %}}
|
{{% /influxdb/custom-timestamps %}}
|
||||||
|
|
||||||
|
<!--setup-test
|
||||||
|
```sh
|
||||||
|
curl --silent \
|
||||||
|
"https://{{< influxdb/host >}}/write?db=get-started&precision=s" \
|
||||||
|
--header "Authorization: Bearer DATABASE_TOKEN" \
|
||||||
|
--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 1719907200
|
||||||
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719907200
|
||||||
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719910800
|
||||||
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719910800
|
||||||
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719914400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719914400
|
||||||
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719918000
|
||||||
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719918000
|
||||||
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719921600
|
||||||
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719921600
|
||||||
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719925200
|
||||||
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719925200
|
||||||
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719928800
|
||||||
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719928800
|
||||||
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719932400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719932400
|
||||||
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719936000
|
||||||
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719936000
|
||||||
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719939600
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719939600
|
||||||
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719943200
|
||||||
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719943200
|
||||||
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719946800
|
||||||
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719946800
|
||||||
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719950400
|
||||||
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719950400
|
||||||
|
"
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
|
||||||
{{% note %}}
|
{{% note %}}
|
||||||
Some examples in this getting started tutorial assume your InfluxDB
|
Some examples in this getting started tutorial assume your InfluxDB
|
||||||
credentials (**URL** and **token**) are provided by
|
credentials (**URL** and **token**) are provided by
|
||||||
|
@ -233,21 +273,33 @@ Provide the following:
|
||||||
|
|
||||||
{{% influxdb/custom-timestamps %}}
|
{{% influxdb/custom-timestamps %}}
|
||||||
{{% code-placeholders "get-started" %}}
|
{{% code-placeholders "get-started" %}}
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influxctl query \
|
influxctl query \
|
||||||
--database get-started \
|
--database get-started \
|
||||||
--token $INFLUX_TOKEN \
|
--token $INFLUX_TOKEN \
|
||||||
"SELECT
|
"SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
home
|
home
|
||||||
WHERE
|
WHERE
|
||||||
time >= '2022-01-01T08:00:00Z'
|
time >= '2022-01-01T08:00:00Z'
|
||||||
AND time <= '2022-01-01T20:00:00Z'"
|
AND time <= '2022-01-01T20:00:00Z'"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
{{% /influxdb/custom-timestamps %}}
|
{{% /influxdb/custom-timestamps %}}
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
#### Query using stored credentials
|
||||||
|
|
||||||
|
Optionally, you can configure `database` and `token` query credentials in your `influxctl`
|
||||||
|
[connection profile](/influxdb/clustered/reference/cli/influxctl/#create-a-configuration-file).
|
||||||
|
|
||||||
|
The `--database` and `--token` command line flags override credentials in your
|
||||||
|
configuration file.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
<!--------------------------- END influxctl CONTENT --------------------------->
|
<!--------------------------- END influxctl CONTENT --------------------------->
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
{{% tab-content %}}
|
{{% tab-content %}}
|
||||||
|
@ -606,7 +658,7 @@ _If your project's virtual environment is already running, skip to step 3._
|
||||||
|
|
||||||
2. Defines a `Query()` function that does the following:
|
2. Defines a `Query()` function that does the following:
|
||||||
|
|
||||||
1. Instantiates `influx.Client` with InfluxDB credentials.
|
1. Instantiates `influx.Client` with the following parameters for InfluxDB credentials:
|
||||||
|
|
||||||
- **`Host`**: your {{% product-name omit=" Clustered" %}} cluster URL
|
- **`Host`**: your {{% product-name omit=" Clustered" %}} cluster URL
|
||||||
- **`Database`**: the name of your {{% product-name %}} database
|
- **`Database`**: the name of your {{% product-name %}} database
|
||||||
|
@ -637,7 +689,7 @@ _If your project's virtual environment is already running, skip to step 3._
|
||||||
<!--pytest.mark.skip-->
|
<!--pytest.mark.skip-->
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go mod tidy && go build && go run influxdb_go_client
|
go mod tidy && go run influxdb_go_client
|
||||||
```
|
```
|
||||||
|
|
||||||
The program executes the `main()` function that writes the data and prints the query results to the console.
|
The program executes the `main()` function that writes the data and prints the query results to the console.
|
||||||
|
|
|
@ -204,32 +204,32 @@ influxctl write \
|
||||||
--database get-started \
|
--database get-started \
|
||||||
--token $INFLUX_TOKEN \
|
--token $INFLUX_TOKEN \
|
||||||
--precision s \
|
--precision s \
|
||||||
'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400
|
'home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||||
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
|
||||||
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
|
||||||
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
|
||||||
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
|
||||||
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
|
||||||
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
|
||||||
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
|
||||||
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
|
||||||
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
|
||||||
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
|
||||||
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
|
||||||
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
|
||||||
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
|
||||||
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
|
||||||
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
|
||||||
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600'
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200'
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /code-placeholders %}}
|
{{% /code-placeholders %}}
|
||||||
|
@ -258,32 +258,32 @@ and then write it to {{< product-name >}}.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cat <<- EOF > home.lp
|
cat <<- EOF > home.lp
|
||||||
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719820800
|
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719820800
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719824400
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719824400
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||||
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719828000
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
|
||||||
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719828000
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
|
||||||
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719831600
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719831600
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
|
||||||
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719835200
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
|
||||||
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719835200
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719838800
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
|
||||||
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719838800
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719842400
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
|
||||||
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719842400
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719846000
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
|
||||||
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719846000
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719849600
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719849600
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
|
||||||
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719853200
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
|
||||||
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719853200
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
|
||||||
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719856800
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
|
||||||
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719856800
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
|
||||||
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719860400
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
|
||||||
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719860400
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
|
||||||
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719864000
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
|
||||||
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719864000
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -467,32 +467,32 @@ response=$(curl --silent --write-out "%{response_code}:-%{errormsg}" \
|
||||||
--header "Content-type: text/plain; charset=utf-8" \
|
--header "Content-type: text/plain; charset=utf-8" \
|
||||||
--header "Accept: application/json" \
|
--header "Accept: application/json" \
|
||||||
--data-binary "
|
--data-binary "
|
||||||
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400
|
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||||
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
|
||||||
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
|
||||||
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
|
||||||
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
|
||||||
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
|
||||||
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
|
||||||
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
|
||||||
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
|
||||||
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
|
||||||
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
|
||||||
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
|
||||||
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
|
||||||
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
|
||||||
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
|
||||||
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
|
||||||
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
|
||||||
")
|
")
|
||||||
|
|
||||||
# Format the response code and error message output.
|
# Format the response code and error message output.
|
||||||
|
@ -578,32 +578,32 @@ response=$(curl --silent --write-out "%{response_code}:-%{errormsg}" \
|
||||||
--header "Content-Type: text/plain; charset=utf-8" \
|
--header "Content-Type: text/plain; charset=utf-8" \
|
||||||
--header "Accept: application/json" \
|
--header "Accept: application/json" \
|
||||||
--data-binary "
|
--data-binary "
|
||||||
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1719734400
|
home,room=Living\ Room temp=21.1,hum=35.9,co=0i 1641024000
|
||||||
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1719734400
|
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
|
||||||
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1719738000
|
home,room=Living\ Room temp=21.4,hum=35.9,co=0i 1641027600
|
||||||
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1719738000
|
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
|
||||||
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1719741600
|
home,room=Living\ Room temp=21.8,hum=36.0,co=0i 1641031200
|
||||||
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1719741600
|
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200
|
||||||
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1719745200
|
home,room=Living\ Room temp=22.2,hum=36.0,co=0i 1641034800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1719745200
|
home,room=Kitchen temp=22.4,hum=36.0,co=0i 1641034800
|
||||||
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1719748800
|
home,room=Living\ Room temp=22.2,hum=35.9,co=0i 1641038400
|
||||||
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1719748800
|
home,room=Kitchen temp=22.5,hum=36.0,co=0i 1641038400
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1719752400
|
home,room=Living\ Room temp=22.4,hum=36.0,co=0i 1641042000
|
||||||
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1719752400
|
home,room=Kitchen temp=22.8,hum=36.5,co=1i 1641042000
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1719756000
|
home,room=Living\ Room temp=22.3,hum=36.1,co=0i 1641045600
|
||||||
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1719756000
|
home,room=Kitchen temp=22.8,hum=36.3,co=1i 1641045600
|
||||||
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1719759600
|
home,room=Living\ Room temp=22.3,hum=36.1,co=1i 1641049200
|
||||||
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1719759600
|
home,room=Kitchen temp=22.7,hum=36.2,co=3i 1641049200
|
||||||
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1719763200
|
home,room=Living\ Room temp=22.4,hum=36.0,co=4i 1641052800
|
||||||
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1719763200
|
home,room=Kitchen temp=22.4,hum=36.0,co=7i 1641052800
|
||||||
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1719766800
|
home,room=Living\ Room temp=22.6,hum=35.9,co=5i 1641056400
|
||||||
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1719766800
|
home,room=Kitchen temp=22.7,hum=36.0,co=9i 1641056400
|
||||||
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1719770400
|
home,room=Living\ Room temp=22.8,hum=36.2,co=9i 1641060000
|
||||||
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1719770400
|
home,room=Kitchen temp=23.3,hum=36.9,co=18i 1641060000
|
||||||
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1719774000
|
home,room=Living\ Room temp=22.5,hum=36.3,co=14i 1641063600
|
||||||
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1719774000
|
home,room=Kitchen temp=23.1,hum=36.6,co=22i 1641063600
|
||||||
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1719777600
|
home,room=Living\ Room temp=22.2,hum=36.4,co=17i 1641067200
|
||||||
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1719777600
|
home,room=Kitchen temp=22.7,hum=36.5,co=26i 1641067200
|
||||||
")
|
")
|
||||||
|
|
||||||
# Format the response code and error message output.
|
# Format the response code and error message output.
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
|
|
||||||
TEST_CONTENT="/app/content"
|
TEST_CONTENT="/app/content"
|
||||||
|
|
||||||
|
# Pattern to match a 10-digit Unix timestamp
|
||||||
|
TIMESTAMP_PATTERN='[0-9]{10}'
|
||||||
|
|
||||||
|
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
YESTERDAY=$(date -u -d 'yesterday 00:00' '+%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
function substitute_placeholders {
|
function substitute_placeholders {
|
||||||
for file in `find "$TEST_CONTENT" -type f \( -iname '*.md' \)`; do
|
for file in `find "$TEST_CONTENT" -type f \( -iname '*.md' \)`; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
|
@ -12,9 +18,37 @@ function substitute_placeholders {
|
||||||
|
|
||||||
# Replaces placeholder values with environment variable references.
|
# Replaces placeholder values with environment variable references.
|
||||||
|
|
||||||
|
# Date-specific replacements.
|
||||||
|
|
||||||
|
grep -oE "$TIMESTAMP_PATTERN" "$file" | while read -r timestamp; do
|
||||||
|
# Replace Unix timestamps (for example, in line protocol sample data) with yesterday's date.
|
||||||
|
# Assuming the Unix timestamp is the whole line or a standalone word in the line
|
||||||
|
# Validate the extracted timestamp (optional)
|
||||||
|
if [[ $timestamp =~ ^1641[0-9]{6,12}$ ]]; then
|
||||||
|
specific_timestamp=$timestamp
|
||||||
|
|
||||||
|
# Extract the time part
|
||||||
|
specific_time=$(date -u -d "@$specific_timestamp" '+%T')
|
||||||
|
|
||||||
|
# Calculate 'yesterday' date but use 'specific_time' for the time part
|
||||||
|
yesterday_date=$(date -u -d 'yesterday' '+%Y-%m-%d')
|
||||||
|
yesterday_datetime="$yesterday_date"T"$specific_time"Z
|
||||||
|
|
||||||
|
# Convert 'yesterday_datetime' to Unix timestamp
|
||||||
|
yesterday_timestamp=$(date -u -d "$yesterday_datetime" +%s)
|
||||||
|
|
||||||
|
# Replace the extracted timestamp with `yesterday_timestamp`
|
||||||
|
sed -i "s|$specific_timestamp|$yesterday_timestamp|g;" $file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
## Adjust time bounds in queries to be the current time and yesterday.
|
||||||
|
sed -i "s|'2022-01-01T20:00:00Z'|'$NOW'|g;
|
||||||
|
s|'2022-01-01T08:00:00Z'|'$YESTERDAY'|g;
|
||||||
|
" $file
|
||||||
|
|
||||||
# Non-language-specific replacements.
|
# Non-language-specific replacements.
|
||||||
sed -i 's|https:\/\/{{< influxdb/host >}}|$INFLUX_HOST|g;
|
sed -i 's|https:\/\/{{< influxdb/host >}}|$INFLUX_HOST|g;' $file
|
||||||
' $file
|
|
||||||
|
|
||||||
# Python-specific replacements.
|
# Python-specific replacements.
|
||||||
# Use f-strings to identify placeholders in Python while also keeping valid syntax if
|
# Use f-strings to identify placeholders in Python while also keeping valid syntax if
|
||||||
|
@ -38,9 +72,6 @@ function substitute_placeholders {
|
||||||
s|"name": "BUCKET_NAME"|"name": "$INFLUX_DATABASE"|g;' \
|
s|"name": "BUCKET_NAME"|"name": "$INFLUX_DATABASE"|g;' \
|
||||||
$file
|
$file
|
||||||
|
|
||||||
sed -i 's|"influxctl database create --retention-period 1y get-started"|"influxctl database create --retention-period 1y $INFLUX_TMP_DATABASE"|g;' \
|
|
||||||
$file
|
|
||||||
|
|
||||||
# Replace remaining placeholders with variables.
|
# Replace remaining placeholders with variables.
|
||||||
# If the placeholder is inside of a Python os.getenv() function, don't replace it.
|
# If the placeholder is inside of a Python os.getenv() function, don't replace it.
|
||||||
# Note the specific use of double quotes for the os.getenv() arguments here. You'll need to use double quotes in your code samples for this to match.
|
# Note the specific use of double quotes for the os.getenv() arguments here. You'll need to use double quotes in your code samples for this to match.
|
||||||
|
|
Loading…
Reference in New Issue