resolved merge conflicts
commit
3be86cb9ae
File diff suppressed because it is too large
Load Diff
|
@ -107,6 +107,7 @@
|
|||
|
||||
.products {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
flex-wrap: wrap;
|
||||
flex-grow: 1;
|
||||
justify-content: flex-start;
|
||||
|
@ -178,6 +179,30 @@
|
|||
}
|
||||
}
|
||||
|
||||
td,label,li {
|
||||
&:after {
|
||||
display: inline-block;
|
||||
vertical-align: text-bottom;
|
||||
font-style: italic;
|
||||
font-weight: $medium;
|
||||
font-size: .75em;
|
||||
margin-left: .35rem;
|
||||
padding: .1rem .3rem .12rem;
|
||||
line-height: .75rem;
|
||||
border-radius: 1rem;
|
||||
}
|
||||
&.beta:after {
|
||||
content: 'beta';
|
||||
color: $r-dreamsicle;
|
||||
background: rgba($r-dreamsicle, .1);
|
||||
border: 1px solid $r-dreamsicle;
|
||||
}
|
||||
}
|
||||
|
||||
label:after {
|
||||
margin-left: .15rem;
|
||||
}
|
||||
|
||||
///////////////////////////// InfluxDB URL Triggers ////////////////////////////
|
||||
|
||||
.article--content {
|
||||
|
@ -211,6 +236,6 @@
|
|||
}
|
||||
|
||||
.code-tab-content {
|
||||
.select-url{margin-top: -3.25rem}
|
||||
.select-url{margin-top: -3.25rem}
|
||||
}
|
||||
}
|
|
@ -22,5 +22,5 @@
|
|||
"layouts/algolia-search-overrides",
|
||||
"layouts/landing",
|
||||
"layouts/error-page",
|
||||
"layouts/modal",
|
||||
"layouts/cloud-selector",
|
||||
"layouts/feature-callouts";
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
title: Manage multiple members
|
||||
description: >
|
||||
View and manage multiple members in an InfluxDB Cloud account.
|
||||
weight: 4
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Account management
|
||||
name: Manage multiple members
|
||||
---
|
||||
|
||||
{{< cloud-name >}} accounts support multiple members in an organization.
|
||||
Collaborate with others using these features.
|
||||
By default, each member has full permissions on resources in your organization.
|
||||
|
||||
{{< children >}}
|
||||
|
||||
{{% cloud %}}
|
||||
**Known issue**: Currently, checks created before a member is added are not visible to that member.
|
||||
{{% /cloud %}}
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: Invite a member
|
||||
list_title: Invite a member
|
||||
description: >
|
||||
Invite a member to collaborate in InfluxDB Cloud.
|
||||
weight: 103
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Manage multiple members
|
||||
name: Invite a member
|
||||
---
|
||||
|
||||
1. Navigate to the **Members** page under **Organizations** in the left navigation bar.
|
||||
{{< nav-icon "org" >}}
|
||||
2. Under **Add a new member to your organization**, enter the email address of the member to invite.
|
||||
(Members must be invited one at a time.)
|
||||
3. Click **Add & Invite**.
|
||||
|
||||
An invitation with an activation link is sent to the specified email address.
|
||||
The activation link expires after 72 hours.
|
||||
|
||||
Once activated, the new member is added as an **Owner** with permissions to read and write all resources.
|
||||
|
||||
{{% warn %}}
|
||||
Currently, Cloud 2.0 has only one permission level: Owner.
|
||||
With Owner permissions, a member can delete resources and other members from your organization.
|
||||
Take care when inviting a member.
|
||||
{{% /warn %}}
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
title: Remove a member
|
||||
seotitle: Remove a member from your InfluxDB Cloud organization
|
||||
description: >
|
||||
Remove a member from an InfluxDB Cloud organization.
|
||||
weight: 103
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Manage multiple members
|
||||
identifier: remove_member_cloud
|
||||
---
|
||||
|
||||
1. Navigate to the **Members** page under **Organizations** in the left navigation bar.
|
||||
{{< nav-icon "org" >}}
|
||||
2. Click the {{< icon "delete" >}} next to the member you want to remove.
|
||||
3. Confirm the removal.
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Manage multiple users
|
||||
description: >
|
||||
View and manage multiple users in an InfluxDB Cloud account.
|
||||
weight: 4
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Account management
|
||||
name: Manage multiple users
|
||||
---
|
||||
|
||||
{{< cloud-name >}} accounts support multiple users in an organization.
|
||||
Collaborate with others using these features.
|
||||
By default, each user has full permissions on resources in your organization.
|
||||
|
||||
{{< children >}}
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Invite a user
|
||||
list_title: Invite a user
|
||||
description: >
|
||||
Invite a user to collaborate in InfluxDB Cloud.
|
||||
weight: 103
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Manage multiple users
|
||||
identifier: invite_user_cloud
|
||||
---
|
||||
|
||||
1. Navigate to the **Users** page in the left navigation bar.
|
||||
2. Under **Add a new user to your organization**, enter the email address of the user to invite.
|
||||
(Users must be invited one at a time.)
|
||||
3. Click **Add & Invite**.
|
||||
|
||||
An invitation with an activation link is sent to the specified email address.
|
||||
The activation link expires after 72 hours.
|
||||
|
||||
Once activated, the new user is added as an **Owner** with permissions to read and write all resources.
|
||||
|
||||
{{% warn %}}
|
||||
Currently, Cloud 2.0 has only one permission level: Owner.
|
||||
With Owner permissions, a user can delete resources and other users from your organization.
|
||||
Take care when inviting a user.
|
||||
{{% /warn %}}
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: Remove a user
|
||||
seotitle: Remove a user from your InfluxDB Cloud organization
|
||||
description: >
|
||||
Remove a user from an InfluxDB Cloud organization.
|
||||
weight: 103
|
||||
menu:
|
||||
v2_0:
|
||||
parent: Manage multiple users
|
||||
identifier: remove_user_cloud
|
||||
---
|
||||
|
||||
1. Navigate to the **Users** page in the left navigation bar.
|
||||
2. Click the {{< icon "delete" >}} next to the user you want to remove.
|
||||
3. Confirm the removal.
|
|
@ -38,9 +38,14 @@ Limits are designed to let you monitor 5-10 sensors, stacks or servers comfortab
|
|||
1. Choose one of the following:
|
||||
- **Subscribe through InfluxData**
|
||||
To subscribe to an InfluxDB Cloud 2.0 **Free Plan** through InfluxData,
|
||||
go to [InfluxDB Cloud 2.0]({{< cloud-link >}}), enter your credentials,
|
||||
and then click **Start your Free Plan now**.
|
||||
When you're ready to grow, [upgrade to the Usage-Based Plan](/v2.0/account-management/billing/#upgrade-to-usage-based-plan).
|
||||
go to [InfluxDB Cloud 2.0]({{< cloud-link >}}).
|
||||
|
||||
- To use social sign-on, click **Continue with Google**. Note that Google social sign-on does not support email aliases.
|
||||
|
||||
- Sign up with email by entering your name, email address, and password, then click **Create Account**.
|
||||
|
||||
If you originally signed up with email but want to enable social sign-on, you can do so by logging in through Google as long as you use the same email address.
|
||||
|
||||
- **Subscribe through a cloud provider**
|
||||
To subscribe to an InfluxDB Cloud **Usage-Based** plan and pay through your
|
||||
**Amazon Web Services (AWS)** or **Google Cloud Platform (GCP)** account:
|
||||
|
@ -61,16 +66,12 @@ Limits are designed to let you monitor 5-10 sensors, stacks or servers comfortab
|
|||
Currently, we do **not support** using an existing InfluxDB Cloud 2.0 account to sign up for an InfluxDB Cloud 2.0 plan through AWS or GCP Marketplaces.
|
||||
{{%/note%}}
|
||||
|
||||
2. InfluxDB Cloud requires email verification to complete the sign up process.
|
||||
2. If you signed up with your email address, InfluxDB Cloud requires email verification to complete the sign up process.
|
||||
Verify your email address by opening the email sent to the address you provided and clicking **Verify Your Email**.
|
||||
3. (If you subscribed through InfluxData) Choose your cloud provider.
|
||||
4. Select a provider and region for your {{< cloud-name >}} instance. The following are available:
|
||||
|
||||
- **Amazon Web Services (AWS)**
|
||||
- **US West (Oregon)**
|
||||
- **EU Frankfurt**
|
||||
- **Google Cloud Platform (GCP)**
|
||||
- **Iowa**
|
||||
{{< cloud_regions type="list" >}}
|
||||
|
||||
_To suggest regions to add, click **Let us know** under Regions._
|
||||
5. (If you subscribed through InfluxData) Review the terms of the agreement, and then select **I have viewed and agree to InfluxDB Cloud 2.0 Services Subscription Agreement and InfluxData Global Data Processing Agreement**.
|
||||
|
@ -116,7 +117,7 @@ executables, and running the initial setup process.
|
|||
### Download and install InfluxDB v2.0 beta
|
||||
Download InfluxDB v2.0 beta for macOS.
|
||||
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.10_darwin_amd64.tar.gz" download>InfluxDB v2.0 beta (macOS)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.12_darwin_amd64.tar.gz" download>InfluxDB v2.0 beta (macOS)</a>
|
||||
|
||||
### Unpackage the InfluxDB binaries
|
||||
To unpackage the downloaded archive, **double click the archive file in Finder**
|
||||
|
@ -125,7 +126,7 @@ or run the following command in a macOS command prompt application such
|
|||
|
||||
```sh
|
||||
# Unpackage contents to the current working directory
|
||||
tar zxvf ~/Downloads/influxdb_2.0.0-beta.10_darwin_amd64.tar.gz
|
||||
tar zxvf ~/Downloads/influxdb_2.0.0-beta.12_darwin_amd64.tar.gz
|
||||
```
|
||||
|
||||
#### (Optional) Place the binaries in your $PATH
|
||||
|
@ -134,7 +135,7 @@ prefix the executables with `./` to run then in place.
|
|||
|
||||
```sh
|
||||
# (Optional) Copy the influx and influxd binary to your $PATH
|
||||
sudo cp influxdb_2.0.0-beta.10_darwin_amd64/{influx,influxd} /usr/local/bin/
|
||||
sudo cp influxdb_2.0.0-beta.12_darwin_amd64/{influx,influxd} /usr/local/bin/
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
@ -198,8 +199,8 @@ influxd --reporting-disabled
|
|||
### Download and install InfluxDB v2.0 beta
|
||||
Download the InfluxDB v2.0 beta package appropriate for your chipset.
|
||||
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.10_linux_amd64.tar.gz" download >InfluxDB v2.0 beta (amd64)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.10_linux_arm64.tar.gz" download >InfluxDB v2.0 beta (arm)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.12_linux_amd64.tar.gz" download >InfluxDB v2.0 beta (amd64)</a>
|
||||
<a class="btn download" href="https://dl.influxdata.com/influxdb/releases/influxdb_2.0.0-beta.12_linux_arm64.tar.gz" download >InfluxDB v2.0 beta (arm)</a>
|
||||
|
||||
### Place the executables in your $PATH
|
||||
Unpackage the downloaded archive and place the `influx` and `influxd` executables in your system `$PATH`.
|
||||
|
@ -208,10 +209,10 @@ _**Note:** The following commands are examples. Adjust the file names, paths, an
|
|||
|
||||
```sh
|
||||
# Unpackage contents to the current working directory
|
||||
tar xvzf path/to/influxdb_2.0.0-beta.10_linux_amd64.tar.gz
|
||||
tar xvzf path/to/influxdb_2.0.0-beta.12_linux_amd64.tar.gz
|
||||
|
||||
# Copy the influx and influxd binary to your $PATH
|
||||
sudo cp influxdb_2.0.0-beta.10_linux_amd64/{influx,influxd} /usr/local/bin/
|
||||
sudo cp influxdb_2.0.0-beta.12_linux_amd64/{influx,influxd} /usr/local/bin/
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
|
@ -381,17 +382,17 @@ You are ready to [write or collect data](/v2.0/write-data).
|
|||
|
||||
{{% note %}}
|
||||
#### Using the influx CLI after setting up InfluxDB through the UI
|
||||
To use the [`influx` CLI](/v2.0/reference/cli/influx) after setting up InfluxDB through the UI,
|
||||
use one of the following methods to provide your [authentication token](/v2.0/users/tokens/) to the CLI:
|
||||
To use the [`influx` CLI](/v2.0/reference/cli/influx) after setting up InfluxDB through the UI, provide your [authentication token](/v2.0/users/tokens/), which is automatically generated during the setup process. For instructions on viewing your token via CLI or UI, see [View tokens](/v2.0/security/tokens/view-tokens/).
|
||||
|
||||
1. Pass your token to the `influx` CLI using the `-t` or `--token` flag.
|
||||
2. Set the `INFLUX_TOKEN` environment variable using your token.
|
||||
Use one of the following methods to provide your authentication token to the CLI:
|
||||
|
||||
- Create a new InfluxDB connection configuration using the [`influx config create` command](/v2.0/reference/cli/influx/config/create/).
|
||||
- Pass your token to the `influx` CLI using the `-t` or `--token` flag.
|
||||
- Set the `INFLUX_TOKEN` environment variable using your token.
|
||||
|
||||
```bash
|
||||
export INFLUX_TOKEN=oOooYourAuthTokenOoooOoOO==
|
||||
```
|
||||
3. Store your token in `~/.influxdbv2/credentials`.
|
||||
_The content of the `credentials` file should be only your token._
|
||||
|
||||
_See [View tokens](/v2.0/security/tokens/view-tokens/) for information about
|
||||
retrieving authentication tokens._
|
||||
|
@ -418,7 +419,10 @@ influx setup
|
|||
Enter nothing for an infinite retention period.
|
||||
7. Confirm the details for your primary user, organization, and bucket.
|
||||
|
||||
InfluxDB is now initialized with a primary user, organization, and bucket.
|
||||
InfluxDB is now initialized with a primary user, organization, bucket, and authentication token. It has also create a config profile for you so that you don't have to add organization and token to every command. To view that config profile, use the [`influx config list`](/v2.0/reference/cli/influx/config) command.
|
||||
|
||||
To continue to use InfluxDB via the CLI, you need the authentication token created during setup. To view the token, log into the UI with the credentials created above. (For instructions, see [View tokens in the InfluxDB UI](/v2.0/security/tokens/view-tokens/#view-tokens-in-the-influxdb-ui).)
|
||||
|
||||
You are ready to [write or collect data](/v2.0/write-data).
|
||||
|
||||
{{% note %}}
|
||||
|
@ -458,6 +462,10 @@ For details, see [Scrape data](/v2.0/write-data/scrape-data/).
|
|||
For information about using the InfluxDB v2 API, `influx` CLI, and client libraries to write data,
|
||||
see [Write data to InfluxDB](/v2.0/write-data/).
|
||||
|
||||
#### Demo data
|
||||
If using **{{< cloud-name "short" >}}**, [add a demo data bucket](/v2.0/write-data/sample-data/demo-data/)
|
||||
for quick, **free** access to time series data.
|
||||
|
||||
### Query data
|
||||
|
||||
Query data using Flux, the UI, and the `influx` command line interface.
|
||||
|
@ -484,10 +492,7 @@ The primary differences between InfluxDB OSS 2.0 and InfluxDB Cloud 2.0 are:
|
|||
|
||||
- [InfluxDB scrapers](/v2.0/write-data/scrape-data/) that collect data from specified
|
||||
targets are not available in {{< cloud-name "short" >}}.
|
||||
- {{< cloud-name "short" >}} instances are currently limited to a single organization with a single user.
|
||||
- **InfluxDB Cloud** does not support retrieving data from a file based CSV source
|
||||
using the `file` parameter of the [`csv.from()`](/v2.0/reference/flux/functions/csv/from);
|
||||
however you can use raw CSV data with the `csv` parameter.
|
||||
- {{< cloud-name "short" >}} instances are currently limited to a single organization.
|
||||
|
||||
#### New features in InfluxDB Cloud 2.0
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: InfluxDB templates in InfluxDB Cloud
|
||||
list_title: InfluxDB templates in Cloud
|
||||
description: >
|
||||
Download and use the `influx` CLI to apply and manage InfluxDB templates with
|
||||
your InfluxDB Cloud account.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: InfluxDB templates
|
||||
name: Templates in Cloud
|
||||
weight: 101
|
||||
aliases:
|
||||
- /v2.0/influxdb-templates/get_started_cloud/
|
||||
v2.0/tags: [templates]
|
||||
products: [cloud]
|
||||
---
|
||||
|
||||
If using InfluxDB Cloud, download and use the [`influx` command line interface (CLI)](/v2.0/reference/cli/influx/)
|
||||
to apply and manage templates in your InfluxDB Cloud account.
|
||||
|
||||
InfluxDB OSS 2.0 includes the InfluxDB CLI (`influx`). If you haven’t already, do the following:
|
||||
|
||||
1. [Download and install InfluxDB 2.0 OSS](/v2.0/get-started/#start-with-influxdb-oss).
|
||||
2. [Configure the `influx` CLI](/v2.0/get-started/#set-up-influxdb) to use your
|
||||
InfluxDB Cloud instance URL, organization, and tokens.
|
||||
3. [Use the `influx` CLI](/v2.0/reference/cli/influx/) to use, manage, and create
|
||||
InfluxDB templates:
|
||||
|
||||
- [Use templates](/v2.0/influxdb-templates/use/)
|
||||
- [Create templates](/v2.0/influxdb-templates/create/)
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Create an InfluxDB template
|
||||
description: >
|
||||
Use the InfluxDB UI and the `influx pkg export` command to create InfluxDB templates.
|
||||
Use the InfluxDB UI and the `influx export` command to create InfluxDB templates.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: InfluxDB templates
|
||||
|
@ -10,11 +10,11 @@ menu:
|
|||
weight: 103
|
||||
v2.0/tags: [templates]
|
||||
related:
|
||||
- /v2.0/reference/cli/influx/pkg/export/
|
||||
- /v2.0/reference/cli/influx/pkg/export/all/
|
||||
- /v2.0/reference/cli/influx/export/
|
||||
- /v2.0/reference/cli/influx/export/all/
|
||||
---
|
||||
|
||||
Use the InfluxDB user interface (UI) and the `influx pkg export` command to
|
||||
Use the InfluxDB user interface (UI) and the `influx export` command to
|
||||
create InfluxDB templates.
|
||||
Add resources (buckets, Telegraf configurations, tasks, and more) in the InfluxDB
|
||||
UI and export the resources as a template.
|
||||
|
@ -61,7 +61,7 @@ Do one of the following to export a template:
|
|||
|
||||
### Export all resources
|
||||
To export all templatable resources within an organization to a template manifest,
|
||||
use the `influx pkg export all` command.
|
||||
use the `influx export all` command.
|
||||
Provide the following:
|
||||
|
||||
- **Organization name** or **ID**
|
||||
|
@ -73,17 +73,17 @@ Provide the following:
|
|||
###### Export all resources to a template
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg export all -o <org-name> -f <file-path> -t <token>
|
||||
influx export all -o <org-name> -f <file-path> -t <token>
|
||||
|
||||
# Example
|
||||
influx pkg export all \
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN
|
||||
```
|
||||
|
||||
#### Export resources filtered by labelName or resourceKind
|
||||
The `influx pkg export all` command has an optional `--filter` flag that exports
|
||||
The `influx export all` command has an optional `--filter` flag that exports
|
||||
only resources that match specified label names or resource kinds.
|
||||
Provide multiple filters for both `labelName` and `resourceKind`
|
||||
|
||||
|
@ -97,7 +97,7 @@ and
|
|||
```
|
||||
|
||||
```sh
|
||||
influx pkg export all \
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN \
|
||||
|
@ -107,15 +107,12 @@ influx pkg export all \
|
|||
--filter=labelName=Example2
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
For information about flags, see the
|
||||
[`influx pkg export all` documentation](/v2.0/reference/cli/influx/pkg/export/all/).
|
||||
[`influx export all` documentation](/v2.0/reference/cli/influx/export/all/).
|
||||
|
||||
### Export specific resources
|
||||
To export specific resources within an organization to a template manifest,
|
||||
use the `influx pkg export` with resource flags for each resource to include.
|
||||
use the `influx export` with resource flags for each resource to include.
|
||||
Provide the following:
|
||||
|
||||
- **Organization name** or **ID**
|
||||
|
@ -125,15 +122,15 @@ Provide the following:
|
|||
**JSON** (`.json`) are supported.
|
||||
- **Resource flags** with corresponding lists of resource IDs to include in the template.
|
||||
For information about what resource flags are available, see the
|
||||
[`influx pkg export` documentation](/v2.0/reference/cli/influx/pkg/export/).
|
||||
[`influx export` documentation](/v2.0/reference/cli/influx/export/).
|
||||
|
||||
###### Export specific resources to a template
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg export all -o <org-name> -f <file-path> -t <token> [resource-flags]
|
||||
influx export all -o <org-name> -f <file-path> -t <token> [resource-flags]
|
||||
|
||||
# Example
|
||||
influx pkg export all \
|
||||
influx export all \
|
||||
-o my-org \
|
||||
-f ~/templates/awesome-template.yml \
|
||||
-t $INFLUX_TOKEN \
|
||||
|
@ -193,13 +190,13 @@ metadata:
|
|||
{{< /code-tabs-wrapper >}}
|
||||
|
||||
Using the example above, users are prompted to provide a value for `bucket-name-1`
|
||||
when [installing the template](/v2.0/influxdb-templates/use/#install-templates).
|
||||
when [applying the template](/v2.0/influxdb-templates/use/#apply-templates).
|
||||
Users can also include the `--env-ref` flag with the appropriate key-value pair
|
||||
when installing the template.
|
||||
|
||||
```sh
|
||||
# Set bucket-name-1 to "myBucket"
|
||||
influx pkg \
|
||||
influx apply \
|
||||
-f /path/to/template.yml \
|
||||
--env-ref=bucket-name-1=myBucket
|
||||
```
|
||||
|
@ -211,7 +208,9 @@ exist in the template and what keys to use to replace them._
|
|||
#### Resource fields that support environment references
|
||||
Only the following fields support environment references:
|
||||
|
||||
|
||||
- `metadata.name`
|
||||
- `spec.endpointName`
|
||||
- `spec.associations.name`
|
||||
{{% /note %}}
|
||||
|
||||
## Share your InfluxDB templates
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: Get started with InfluxDB templates
|
||||
description: >
|
||||
To get started with InfluxDB templates, you need to download the InfluxDB CLI.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: InfluxDB templates
|
||||
name: Templates in Cloud
|
||||
identifier: Templates requires CLI
|
||||
weight: 101
|
||||
v2.0/tags: [templates]
|
||||
products: [cloud]
|
||||
---
|
||||
|
||||
If using **InfluxDB Cloud**, download the `influx` command line interface (CLI)
|
||||
and use it to manage InfluxDB templates with your InfluxDB Cloud account.
|
||||
**The `influx` CLI is part of InfluxDB OSS package.**
|
||||
|
||||
- [Download InfluxDB OSS 2.0](/v2.0/get-started/#start-with-influxdb-oss)
|
||||
- [Set up and use InfluxDB CLI](/v2.0/reference/cli/influx/) with the appropriate
|
||||
InfluxDB Cloud instance URL, organization, and tokens associated with your
|
||||
**InfluxDB Cloud** account.
|
||||
|
||||
Use the `influx pkg` command to:
|
||||
|
||||
- [Use templates](/v2.0/influxdb-templates/use/)
|
||||
- [Create templates](/v2.0/influxdb-templates/create/)
|
||||
- [Manage InfluxDB stacks](/v2.0/influxdb-templates/stacks/)
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: Use InfluxDB templates
|
||||
description: >
|
||||
Use the `influx pkg` command to view and install templates from your local
|
||||
filesystem or from URLs.
|
||||
Use the `influx` command line interface (CLI) to summarize, validate, and apply
|
||||
templates from your local filesystem and from URLs.
|
||||
menu:
|
||||
v2_0:
|
||||
parent: InfluxDB templates
|
||||
|
@ -10,23 +10,25 @@ menu:
|
|||
weight: 102
|
||||
v2.0/tags: [templates]
|
||||
related:
|
||||
- /v2.0/reference/cli/influx/pkg/
|
||||
- /v2.0/reference/cli/influx/apply/
|
||||
- /v2.0/reference/cli/influx/template/
|
||||
- /v2.0/reference/cli/influx/template/validate/
|
||||
---
|
||||
|
||||
Use the `influx pkg` command to summarize, validate, and install templates from
|
||||
your local filesystem and from URLs.
|
||||
Use the `influx` command line interface (CLI) to summarize, validate, and apply
|
||||
templates from your local filesystem and from URLs.
|
||||
|
||||
- [Use InfluxDB community templates](#use-influxdb-community-templates)
|
||||
- [View a template summary](#view-a-template-summary)
|
||||
- [Validate a template](#validate-a-template)
|
||||
- [Install templates](#install-templates)
|
||||
- [Apply templates](#apply-templates)
|
||||
|
||||
|
||||
## Use InfluxDB community templates
|
||||
The [InfluxDB community templates repository](https://github.com/influxdata/community-templates/)
|
||||
is home to a growing number of InfluxDB templates developed and maintained by
|
||||
others in the InfluxData community.
|
||||
Install community templates directly from GitHub using a template's download URL
|
||||
Apply community templates directly from GitHub using a template's download URL
|
||||
or download the template.
|
||||
|
||||
{{% note %}}
|
||||
|
@ -47,8 +49,8 @@ https://raw.githubusercontent.com/influxdata/community-templates/master/docker/d
|
|||
<a class="btn" href="https://github.com/influxdata/community-templates/" target="\_blank">View InfluxDB Community Templates</a>
|
||||
|
||||
## View a template summary
|
||||
To view a summary of what's included in a template before installing the template,
|
||||
use the [`influx pkg summary` command](/v2.0/reference/cli/influx/pkg/summary/).
|
||||
To view a summary of what's included in a template before applying the template,
|
||||
use the [`influx template` command](/v2.0/reference/cli/influx/template/).
|
||||
View a summary of a template stored in your local filesystem or from a URL.
|
||||
|
||||
{{% code-tabs-wrapper %}}
|
||||
|
@ -59,26 +61,26 @@ View a summary of a template stored in your local filesystem or from a URL.
|
|||
{{% code-tab-content %}}
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg summary -f <template-file-path>
|
||||
influx template -f <template-file-path>
|
||||
|
||||
# Example
|
||||
influx pkg summary -f /path/to/template.yml
|
||||
influx template -f /path/to/template.yml
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg summary -u <template-url>
|
||||
influx template -u <template-url>
|
||||
|
||||
# Example
|
||||
influx pkg summary -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
|
||||
influx template -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% /code-tabs-wrapper %}}
|
||||
|
||||
## Validate a template
|
||||
To validate a template before you install it or troubleshoot a template, use
|
||||
the [`influx pkg validate` command](/v2.0/reference/cli/influx/pkg/validate/).
|
||||
the [`influx template validate` command](/v2.0/reference/cli/influx/template/validate/).
|
||||
Validate a template stored in your local filesystem or from a URL.
|
||||
|
||||
{{% code-tabs-wrapper %}}
|
||||
|
@ -89,99 +91,99 @@ Validate a template stored in your local filesystem or from a URL.
|
|||
{{% code-tab-content %}}
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg validate -f <template-file-path>
|
||||
influx template validate -f <template-file-path>
|
||||
|
||||
# Example
|
||||
influx pkg validate -f /path/to/template.yml
|
||||
influx template validate -f /path/to/template.yml
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% code-tab-content %}}
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg validate -u <template-url>
|
||||
influx template validate -u <template-url>
|
||||
|
||||
# Example
|
||||
influx pkg validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
|
||||
influx template validate -u https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{% /code-tabs-wrapper %}}
|
||||
|
||||
## Install templates
|
||||
Use the [`influx pkg` command](/v2.0/reference/cli/influx/pkg/) to install templates
|
||||
## Apply templates
|
||||
Use the [`influx apply` command](/v2.0/reference/cli/influx/apply/) to install templates
|
||||
from your local filesystem or from URLs.
|
||||
|
||||
- [Install a template from a file](#install-a-template-from-a-file)
|
||||
- [Install all templates in a directory](#install-all-templates-in-a-directory)
|
||||
- [Install a template from a URL](#install-a-template-from-a-url)
|
||||
- [Install templates from both files and URLs](#install-templates-from-both-files-and-urls)
|
||||
- [Apply a template from a file](#apply-a-template-from-a-file)
|
||||
- [Apply all templates in a directory](#apply-all-templates-in-a-directory)
|
||||
- [Apply a template from a URL](#apply-a-template-from-a-url)
|
||||
- [Apply templates from both files and URLs](#apply-templates-from-both-files-and-urls)
|
||||
- [Define environment references](#define-environment-references)
|
||||
- [Include a secret when installing a template](#include-a-secret-when-installing-a-template)
|
||||
|
||||
### Install a template from a file
|
||||
### Apply a template from a file
|
||||
To install templates stored on your local machine, use the `-f` or `--file` flag
|
||||
to provide the **file path** of the template manifest.
|
||||
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg -o <org-name> -f <template-file-path>
|
||||
influx apply -o <org-name> -f <template-file-path>
|
||||
|
||||
# Examples
|
||||
# Install a single template
|
||||
influx pkg -o example-org -f /path/to/template.yml
|
||||
# Apply a single template
|
||||
influx apply -o example-org -f /path/to/template.yml
|
||||
|
||||
# Install multiple templates
|
||||
influx pkg -o example-org \
|
||||
# Apply multiple templates
|
||||
influx apply -o example-org \
|
||||
-f /path/to/this/template.yml \
|
||||
-f /path/to/that/template.yml
|
||||
```
|
||||
|
||||
### Install all templates in a directory
|
||||
To install all templates in a directory, use the `-f` or `--file` flag to provide
|
||||
### Apply all templates in a directory
|
||||
To apply all templates in a directory, use the `-f` or `--file` flag to provide
|
||||
the **directory path** of the directory where template manifests are stored.
|
||||
By default, this only installs templates stored in the specified directory.
|
||||
To install all templates stored in the specified directory and its subdirectories,
|
||||
include the `--recurse` flag.
|
||||
By default, this only applies templates stored in the specified directory.
|
||||
To apply all templates stored in the specified directory and its subdirectories,
|
||||
include the `-R`, `--recurse` flag.
|
||||
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg -o <org-name> -f <template-directory-path>
|
||||
influx apply -o <org-name> -f <template-directory-path>
|
||||
|
||||
# Examples
|
||||
# Install all templates in a directory
|
||||
influx pkg -o example-org -f /path/to/template/dir/
|
||||
# Apply all templates in a directory
|
||||
influx apply -o example-org -f /path/to/template/dir/
|
||||
|
||||
# Install all templates in a directory and its subdirectories
|
||||
influx pkg -o example-org -f /path/to/template/dir/ --recurse
|
||||
# Apply all templates in a directory and its subdirectories
|
||||
influx apply -o example-org -f /path/to/template/dir/ -R
|
||||
```
|
||||
|
||||
### Install a template from a URL
|
||||
To install templates from a URL, use the `-u` or `--url` flag to provide the URL
|
||||
### Apply a template from a URL
|
||||
To apply templates from a URL, use the `-u` or `--template-url` flag to provide the URL
|
||||
of the template manifest.
|
||||
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg -o <org-name> -u <template-url>
|
||||
influx apply -o <org-name> -u <template-url>
|
||||
|
||||
# Examples
|
||||
# Install a single template from a URL
|
||||
influx pkg -o example-org -u https://example.com/templates/template.yml
|
||||
# Apply a single template from a URL
|
||||
influx apply -o example-org -u https://example.com/templates/template.yml
|
||||
|
||||
# Install multiple templates from URLs
|
||||
influx pkg -o example-org \
|
||||
# Apply multiple templates from URLs
|
||||
influx apply -o example-org \
|
||||
-u https://example.com/templates/template1.yml \
|
||||
-u https://example.com/templates/template2.yml
|
||||
```
|
||||
|
||||
### Install templates from both files and URLs
|
||||
To install templates from both files and URLs in a single command, include multiple
|
||||
### Apply templates from both files and URLs
|
||||
To apply templates from both files and URLs in a single command, include multiple
|
||||
file or directory paths and URLs, each with the appropriate `-f` or `-u` flag.
|
||||
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg -o <org-name> -u <template-url> -f <template-path>
|
||||
influx apply -o <org-name> -u <template-url> -f <template-path>
|
||||
|
||||
# Example
|
||||
influx pkg -o example-org \
|
||||
influx apply -o example-org \
|
||||
-u https://example.com/templates/template1.yml \
|
||||
-u https://example.com/templates/template2.yml \
|
||||
-f ~/templates/custom-template.yml \
|
||||
|
@ -191,14 +193,14 @@ influx pkg -o example-org \
|
|||
|
||||
### Define environment references
|
||||
Some templates include [environment references](/v2.0/influxdb-templates/create/#include-user-definable-resource-names) that let you provide custom resource names.
|
||||
The `influx pkg` command prompts you to provide a value for each environment
|
||||
The `influx apply` command prompts you to provide a value for each environment
|
||||
reference in the template.
|
||||
You can also provide values for environment references by including an `--env-ref`
|
||||
flag with a key-value pair comprised of the environment reference key and the
|
||||
value to replace it.
|
||||
|
||||
```sh
|
||||
influx pkg -o example-org -f /path/to/template.yml \
|
||||
influx apply -o example-org -f /path/to/template.yml \
|
||||
--env-ref=bucket-name-1=myBucket
|
||||
--env-ref=label-name-1=Label1 \
|
||||
--env-ref=label-name-2=Label2
|
||||
|
@ -212,18 +214,18 @@ with the secret key-value pair.
|
|||
|
||||
```sh
|
||||
# Syntax
|
||||
influx pkg -o <org-name> -f <template-file-path> \
|
||||
influx apply -o <org-name> -f <template-file-path> \
|
||||
--secret=<secret-key>=<secret-value>
|
||||
|
||||
# Examples
|
||||
# Define a single secret when installing a template
|
||||
influx pkg -o example-org -f /path/to/template.yml \
|
||||
# Define a single secret when applying a template
|
||||
influx apply -o example-org -f /path/to/template.yml \
|
||||
--secret=FOO=BAR
|
||||
|
||||
# Define multiple secrets when installing a template
|
||||
influx pkg -o example-org -f /path/to/template.yml \
|
||||
# Define multiple secrets when applying a template
|
||||
influx apply -o example-org -f /path/to/template.yml \
|
||||
--secret=FOO=bar \
|
||||
--secret=BAZ=quz
|
||||
```
|
||||
|
||||
_To add a secret after installing a template, see [Add secrets](/v2.0/security/secrets/manage-secrets/add/)._
|
||||
_To add a secret after applying a template, see [Add secrets](/v2.0/security/secrets/manage-secrets/add/)._
|
||||
|
|
|
@ -17,7 +17,3 @@ Checks in InfluxDB query data and apply a status or level to each data point bas
|
|||
Learn how to create and manage checks:
|
||||
|
||||
{{< children >}}
|
||||
|
||||
{{% cloud %}}
|
||||
**Known issue**: Currently in {{< cloud-name >}}, checks created before a [member is added to an organization](/v2.0/account-management/multi-member) are not visible to that member.
|
||||
{{% /cloud %}}
|
||||
|
|
|
@ -26,10 +26,6 @@ To view checks, click **Alerts** in navigation menu on the left.
|
|||
## View a list of all checks
|
||||
The **Checks** section of the Alerts landing page displays all existing checks.
|
||||
|
||||
{{% cloud %}}
|
||||
**Known issue**: Currently in {{< cloud-name >}}, checks created before a [member is added to an organization](/v2.0/account-management/multi-member) are not visible to that member.
|
||||
{{% /cloud %}}
|
||||
|
||||
## View check details
|
||||
Click the name of the check you want to view.
|
||||
The check builder appears.
|
||||
|
|
|
@ -89,9 +89,9 @@ curl http://localhost:9999/api/v2/query?org=my-org -XPOST -sS \
|
|||
-H 'Accept: application/csv' \
|
||||
-H 'Content-type: application/vnd.flux' \
|
||||
-d 'from(bucket:"example-bucket")
|
||||
|> range(start:-1000h)
|
||||
|> group(columns:["_measurement"], mode:"by")
|
||||
|> sum()'
|
||||
|> range(start: -12h)
|
||||
|> filter(fn: (r) => r._measurement == "example-measurement"
|
||||
|> aggregateWindow(every: 1h, fn: mean)'
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
|
||||
|
@ -103,9 +103,9 @@ curl http://localhost:9999/api/v2/query?org=my-org -XPOST -sS \
|
|||
-H 'Content-type: application/vnd.flux' \
|
||||
-H 'Accept-Encoding: gzip' \
|
||||
-d 'from(bucket:"example-bucket")
|
||||
|> range(start:-1000h)
|
||||
|> group(columns:["_measurement"], mode:"by")
|
||||
|> sum()'
|
||||
|> range(start: -12h)
|
||||
|> filter(fn: (r) => r._measurement == "example-measurement"
|
||||
|> aggregateWindow(every: 1h, fn: mean)'
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
{{< /code-tabs-wrapper >}}
|
||||
|
|
|
@ -9,7 +9,7 @@ menu:
|
|||
v2_0:
|
||||
name: Calculate percentages
|
||||
parent: Query with Flux
|
||||
weight: 206
|
||||
weight: 209
|
||||
aliases:
|
||||
- /v2.0/query-data/guides/manipulate-timestamps/
|
||||
related:
|
||||
|
@ -201,7 +201,7 @@ pgHost = secrets.get(key: "POSTGRES_HOST")
|
|||
t1 = sql.from(
|
||||
driverName: "postgres",
|
||||
dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}",
|
||||
query:"SELECT id, name, available FROM exampleTable"
|
||||
query:"SELECT id, name, available FROM example_table"
|
||||
)
|
||||
|
||||
t2 = from(bucket: "example-bucket")
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
---
|
||||
title: Explore your data schema with Flux
|
||||
list_title: Explore your schema
|
||||
description: >
|
||||
Flux provides functions that let you explore the structure and schema of your
|
||||
data stored in InfluxDB.
|
||||
v2.0/tags: [schema]
|
||||
menu:
|
||||
v2_0:
|
||||
name: Explore your schema
|
||||
parent: Query with Flux
|
||||
weight: 206
|
||||
related:
|
||||
- /v2.0/reference/flux/stdlib/built-in/inputs/buckets/
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/measurements
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/tagkeys
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/tagvalues
|
||||
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues
|
||||
list_code_example: |
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
// List buckets
|
||||
buckets()
|
||||
|
||||
// List measurements
|
||||
v1.measurements(bucket: "example-bucket")
|
||||
|
||||
// List field keys
|
||||
v1.fieldKeys(bucket: "example-bucket")
|
||||
|
||||
// List tag keys
|
||||
v1.tagKeys(bucket: "example-bucket")
|
||||
|
||||
// List tag values
|
||||
v1.tagValues(bucket: "example-bucket", tag: "example-tag")
|
||||
```
|
||||
---
|
||||
|
||||
Flux provides functions that let you explore the structure and schema of your
|
||||
data stored in InfluxDB.
|
||||
|
||||
- [List buckets](#list-buckets)
|
||||
- [List measurements](#list-measurements)
|
||||
- [List field keys](#list-field-keys)
|
||||
- [List tag keys](#list-tag-keys)
|
||||
- [List tag values](#list-tag-values)
|
||||
|
||||
## List buckets
|
||||
Use the [`buckets()` function](/v2.0/reference/flux/stdlib/built-in/inputs/buckets/)
|
||||
to list **buckets in your organization**.
|
||||
|
||||
```js
|
||||
buckets()
|
||||
```
|
||||
|
||||
## List measurements
|
||||
Use the [`v1.measurements()` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurements)
|
||||
to list **measurements in a bucket**.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurements(bucket: "example-bucket")
|
||||
```
|
||||
|
||||
## List field keys
|
||||
Use the [`v1.fieldKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys)
|
||||
to list **field keys in a bucket**.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.fieldKeys(bucket: "example-bucket")
|
||||
```
|
||||
|
||||
### List fields in a measurement
|
||||
Use the [`v1.measurementFieldKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys)
|
||||
to list **field keys in a measurement**.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurementFieldKeys(
|
||||
bucket: "example-bucket",
|
||||
measurement: "example-measurement"
|
||||
)
|
||||
```
|
||||
|
||||
## List tag keys
|
||||
Use the [`v1.tagKeys()` function](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)
|
||||
to list **tag keys in a bucket**.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.tagKeys(bucket: "example-bucket")
|
||||
```
|
||||
|
||||
### List tag keys in a measurement
|
||||
Use the [`v1.measurementTagKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys)
|
||||
to list **tag keys in a measurement**.
|
||||
_This function returns results from the last 30 days._
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurementTagKeys(
|
||||
bucket: "example-bucket",
|
||||
measurement: "example-measurement"
|
||||
)
|
||||
```
|
||||
|
||||
## List tag values
|
||||
Use the [`v1.tagValues()` function](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)
|
||||
to list **tag values for a given tag in a bucket**.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.tagValues(bucket: "example-bucket", tag: "example-tag")
|
||||
```
|
||||
|
||||
### List tag values in a measurement
|
||||
Use the [`v1.measurementTagValues` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues)
|
||||
to list **tag values for a given tag in a measurement**.
|
||||
_This function returns results from the last 30 days._
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurementTagValues(
|
||||
bucket: "example-bucket",
|
||||
tag: "example-tag",
|
||||
measurement: "example-measurement"
|
||||
)
|
||||
```
|
|
@ -10,7 +10,7 @@ menu:
|
|||
v2_0:
|
||||
name: Transform data with math
|
||||
parent: Query with Flux
|
||||
weight: 205
|
||||
weight: 208
|
||||
aliases:
|
||||
- /v2.0/query-data/guides/mathematic-operations/
|
||||
related:
|
||||
|
@ -221,7 +221,7 @@ pgHost = secrets.get(key: "POSTGRES_HOST")
|
|||
t1 = sql.from(
|
||||
driverName: "postgres",
|
||||
dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}",
|
||||
query:"SELECT id, name, available FROM exampleTable"
|
||||
query:"SELECT id, name, available FROM example_table"
|
||||
)
|
||||
|
||||
t2 = from(bucket: "example-bucket")
|
||||
|
|
|
@ -32,9 +32,9 @@ This lets you, for example, dynamically set variables using query results.
|
|||
|
||||
**To extract scalar values from output:**
|
||||
|
||||
1. [Extract a table](#extract-a-table).
|
||||
2. [Extract a column from the table](#extract-a-column-from-the-table)
|
||||
_**or**_ [extract a row from the table](#extract-a-row-from-the-table).
|
||||
1. [Extract a column from the input stream](#extract-a-column)
|
||||
_**or**_ [extract a row from the input stream](#extract-a-row).
|
||||
2. Use the returned array or object to reference scalar values.
|
||||
|
||||
_The samples on this page use the [sample data provided below](#sample-data)._
|
||||
|
||||
|
@ -48,61 +48,33 @@ _The samples on this page use the [sample data provided below](#sample-data)._
|
|||
See [#15321](https://github.com/influxdata/influxdb/issues/15231).
|
||||
{{% /warn %}}
|
||||
|
||||
## Extract a table
|
||||
## Table extraction
|
||||
Flux formats query results as a stream of tables.
|
||||
To extract a scalar value from a stream of tables, you must first extract a single table.
|
||||
|
||||
to extract a single table from the stream of tables.
|
||||
|
||||
{{% note %}}
|
||||
If query results include only one table, it is still formatted as a stream of tables.
|
||||
You still must extract that table from the stream.
|
||||
{{% /note %}}
|
||||
|
||||
Use [`tableFind()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/tablefind/)
|
||||
to extract the **first** table whose [group key](/v2.0/reference/glossary/#group-key)
|
||||
values match the `fn` [predicate function](/v2.0/reference/glossary/#predicate-expression).
|
||||
The predicate function requires a `key` object, which represents the group key of
|
||||
each table.
|
||||
|
||||
```js
|
||||
sampleData
|
||||
|> tableFind(fn: (key) =>
|
||||
key._field == "temp" and
|
||||
key.location == "sfo"
|
||||
)
|
||||
```
|
||||
|
||||
The example above returns a single table:
|
||||
|
||||
| _time | location | _field | _value |
|
||||
|:----- |:--------:|:------:| ------:|
|
||||
| 2019-11-01T12:00:00Z | sfo | temp | 65.1 |
|
||||
| 2019-11-01T13:00:00Z | sfo | temp | 66.2 |
|
||||
| 2019-11-01T14:00:00Z | sfo | temp | 66.3 |
|
||||
| 2019-11-01T15:00:00Z | sfo | temp | 66.8 |
|
||||
Both [`findColumn()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findcolumn/)
|
||||
and [`findRecord()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/)
|
||||
extract the first table in a stream of tables whose [group key](/v2.0/reference/glossary/#group-key)
|
||||
values match the `fn` [predicate function](/v2.0/reference/glossary/#predicate-function).
|
||||
|
||||
{{% note %}}
|
||||
#### Extract the correct table
|
||||
Flux functions do not guarantee table order and `tableFind()` returns only the
|
||||
**first** table that matches the `fn` predicate.
|
||||
To extract the table that includes the data you actually want, be very specific in
|
||||
your predicate function or filter and transform your data to minimize the number
|
||||
of tables piped-forward into `tableFind()`.
|
||||
Flux functions do not guarantee table order.
|
||||
`findColumn()` and `findRecord` extract only the **first** table that matches the `fn` predicate.
|
||||
To extract the correct table, be very specific in your predicate function or
|
||||
filter and transform your data to minimize the number of tables piped-forward into the functions.
|
||||
{{% /note %}}
|
||||
|
||||
## Extract a column from the table
|
||||
Use the [`getColumn()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getcolumn/)
|
||||
## Extract a column
|
||||
Use the [`findColumn()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findcolumn/)
|
||||
to output an array of values from a specific column in the extracted table.
|
||||
|
||||
_See [Sample data](#sample-data) below._
|
||||
|
||||
```js
|
||||
sampleData
|
||||
|> tableFind(fn: (key) =>
|
||||
key._field == "temp" and
|
||||
key.location == "sfo"
|
||||
|> findColumn(
|
||||
fn: (key) => key._field == "temp" and key.location == "sfo",
|
||||
column: "_value"
|
||||
)
|
||||
|> getColumn(column: "_value")
|
||||
|
||||
// Returns [65.1, 66.2, 66.3, 66.8]
|
||||
```
|
||||
|
@ -113,13 +85,14 @@ In the example below, `SFOTemps` represents the array of values.
|
|||
Reference a specific index (integer starting from `0`) in the array to return the
|
||||
value at that index.
|
||||
|
||||
_See [Sample data](#sample-data) below._
|
||||
|
||||
```js
|
||||
SFOTemps = sampleData
|
||||
|> tableFind(fn: (key) =>
|
||||
key._field == "temp" and
|
||||
key.location == "sfo"
|
||||
|> findColumn(
|
||||
fn: (key) => key._field == "temp" and key.location == "sfo",
|
||||
column: "_value"
|
||||
)
|
||||
|> getColumn(column: "_value")
|
||||
|
||||
SFOTemps
|
||||
// Returns [65.1, 66.2, 66.3, 66.8]
|
||||
|
@ -131,19 +104,18 @@ SFOTemps[2]
|
|||
// Returns 66.3
|
||||
```
|
||||
|
||||
## Extract a row from the table
|
||||
Use the [`getRecord()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getrecord/)
|
||||
## Extract a row
|
||||
Use the [`findRecord()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/)
|
||||
to output data from a single row in the extracted table.
|
||||
Specify the index of the row to output using the `idx` parameter.
|
||||
The function outputs an object with key-value pairs for each column.
|
||||
|
||||
```js
|
||||
sampleData
|
||||
|> tableFind(fn: (key) =>
|
||||
key._field == "temp" and
|
||||
key.location == "sfo"
|
||||
|> findRecord(
|
||||
fn: (key) => key._field == "temp" and key.location == "sfo",
|
||||
idx: 0
|
||||
)
|
||||
|> getRecord(idx: 0)
|
||||
|
||||
// Returns {
|
||||
// _time:2019-11-11T12:00:00Z,
|
||||
|
@ -161,11 +133,10 @@ keys in the object.
|
|||
|
||||
```js
|
||||
tempInfo = sampleData
|
||||
|> tableFind(fn: (key) =>
|
||||
key._field == "temp" and
|
||||
key.location == "sfo"
|
||||
|> findRecord(
|
||||
fn: (key) => key._field == "temp" and key.location == "sfo",
|
||||
idx: 0
|
||||
)
|
||||
|> getRecord(idx: 0)
|
||||
|
||||
tempInfo
|
||||
// Returns {
|
||||
|
@ -190,8 +161,10 @@ Create custom helper functions to extract scalar values from query output.
|
|||
// Define a helper function to extract field values
|
||||
getFieldValue = (tables=<-, field) => {
|
||||
extract = tables
|
||||
|> tableFind(fn: (key) => key._field == field)
|
||||
|> getColumn(column: "_value")
|
||||
|> findColumn(
|
||||
fn: (key) => key._field == field,
|
||||
column: "_value"
|
||||
)
|
||||
return extract[0]
|
||||
}
|
||||
|
||||
|
@ -210,8 +183,10 @@ lastJFKTemp
|
|||
// Define a helper function to extract a row as an object
|
||||
getRow = (tables=<-, field, idx=0) => {
|
||||
extract = tables
|
||||
|> tableFind(fn: (key) => true)
|
||||
|> getRecord(idx: idx)
|
||||
|> findRecord(
|
||||
fn: (key) => true,
|
||||
idx: idx
|
||||
)
|
||||
return extract
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ seotitle: Query SQL data sources with InfluxDB
|
|||
list_title: Query SQL data
|
||||
description: >
|
||||
The Flux `sql` package provides functions for working with SQL data sources.
|
||||
Use `sql.from()` to query SQL databases like PostgreSQL and MySQL
|
||||
Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, and SQLite.
|
||||
v2.0/tags: [query, flux, sql]
|
||||
menu:
|
||||
v2_0:
|
||||
|
@ -30,8 +30,8 @@ list_code_example: |
|
|||
The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources.
|
||||
[`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources
|
||||
like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/),
|
||||
and [SQLite](https://www.sqlite.org/index.html), and use the results with InfluxDB
|
||||
dashboards, tasks, and other operations.
|
||||
[Snowflake](https://www.snowflake.com/), and [SQLite](https://www.sqlite.org/index.html),
|
||||
and use the results with InfluxDB dashboards, tasks, and other operations.
|
||||
|
||||
- [Query a SQL data source](#query-a-sql-data-source)
|
||||
- [Join SQL data with data in InfluxDB](#join-sql-data-with-data-in-influxdb)
|
||||
|
@ -55,6 +55,7 @@ To query a SQL data source:
|
|||
{{% code-tabs %}}
|
||||
[PostgreSQL](#)
|
||||
[MySQL](#)
|
||||
[Snowflake](#)
|
||||
[SQLite](#)
|
||||
{{% /code-tabs %}}
|
||||
|
||||
|
@ -82,6 +83,18 @@ sql.from(
|
|||
```
|
||||
{{% /code-tab-content %}}
|
||||
|
||||
{{% code-tab-content %}}
|
||||
```js
|
||||
import "sql"
|
||||
|
||||
sql.from(
|
||||
driverName: "snowflake",
|
||||
dataSourceName: "user:password@account/db/exampleschema?warehouse=wh",
|
||||
query: "SELECT * FROM example_table"
|
||||
)
|
||||
```
|
||||
{{% /code-tab-content %}}
|
||||
|
||||
{{% code-tab-content %}}
|
||||
```js
|
||||
// NOTE: InfluxDB OSS and InfluxDB Cloud do not have access to
|
||||
|
|
|
@ -112,6 +112,11 @@ dataSet
|
|||
|> window(every: 1m)
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
The `every` parameter supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
|
||||
including **calendar months (`1mo`)** and **years (`1y`)**.
|
||||
{{% /note %}}
|
||||
|
||||
Each window of time is output in its own table containing all records that fall within the window.
|
||||
|
||||
{{% truncate %}}
|
||||
|
|
|
@ -59,6 +59,12 @@ It's just good to understand the steps in the process.
|
|||
Flux's [`window()` function](/v2.0/reference/flux/stdlib/built-in/transformations/window) partitions records based on a time value.
|
||||
Use the `every` parameter to define a duration of each window.
|
||||
|
||||
{{% note %}}
|
||||
#### Calendar months and years
|
||||
`every` supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
|
||||
including **calendar months (`1mo`)** and **years (`1y`)**.
|
||||
{{% /note %}}
|
||||
|
||||
For this example, window data in five minute intervals (`5m`).
|
||||
|
||||
```js
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: InfluxDB Kotlin client library
|
||||
list_title: Kotlin
|
||||
description: Use the Kotlin client library to interact with InfluxDB.
|
||||
external_url: https://github.com/influxdata/influxdb-client-java/tree/master/client-kotlin
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Kotlin
|
||||
parent: Client libraries
|
||||
url: https://github.com/influxdata/influxdb-client-java/tree/master/client-kotlin
|
||||
weight: 201
|
||||
---
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: InfluxDB Scala client library
|
||||
list_title: Scala
|
||||
description: Use the Scala client library to interact with InfluxDB.
|
||||
external_url: https://github.com/influxdata/influxdb-client-java/tree/master/client-scala
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Scala
|
||||
parent: Client libraries
|
||||
url: https://github.com/influxdata/influxdb-client-java/tree/master/client-scala
|
||||
weight: 201
|
||||
---
|
|
@ -45,21 +45,24 @@ retrieving authentication tokens._
|
|||
## Commands
|
||||
| Command | Description |
|
||||
|:------- |:----------- |
|
||||
| [apply](/v2.0/reference/cli/influx/apply) | Apply an InfluxDB template |
|
||||
| [auth](/v2.0/reference/cli/influx/auth) | Authorization management commands |
|
||||
| [backup](/v2.0/reference/cli/influx/backup) | Back up data |
|
||||
| [bucket](/v2.0/reference/cli/influx/bucket) | Bucket management commands |
|
||||
| [completion](/v2.0/reference/cli/influx/completion) | Generate completion scripts |
|
||||
| [config](/v2.0/reference/cli/influx/config) | Configuration management commands |
|
||||
| [delete](/v2.0/reference/cli/influx/delete) | Delete points from InfluxDB |
|
||||
| [export](/v2.0/reference/cli/influx/export) | Export resources as a template |
|
||||
| [help](/v2.0/reference/cli/influx/help) | Help about any command |
|
||||
| [org](/v2.0/reference/cli/influx/org) | Organization management commands |
|
||||
| [ping](/v2.0/reference/cli/influx/ping) | Check the InfluxDB `/health` endpoint |
|
||||
| [pkg](/v2.0/reference/cli/influx/pkg) | Manage InfluxDB packages |
|
||||
| [query](/v2.0/reference/cli/influx/query) | Execute a Flux query |
|
||||
| [repl](/v2.0/reference/cli/influx/repl) | Interactive REPL (read-eval-print-loop) |
|
||||
| [secret](/v2.0/reference/cli/influx/secret) | Manage secrets |
|
||||
| [setup](/v2.0/reference/cli/influx/setup) | Create default username, password, org, bucket, etc. |
|
||||
| [stacks](/v2.0/reference/cli/influx/stacks) | Manage InfluxDB stacks |
|
||||
| [task](/v2.0/reference/cli/influx/task) | Task management commands |
|
||||
| [template](/v2.0/reference/cli/influx/template) | Summarize and validate an InfluxDB template |
|
||||
| [transpile](/v2.0/reference/cli/influx/transpile) | Manually transpile an InfluxQL query to Flux |
|
||||
| [user](/v2.0/reference/cli/influx/user) | User management commands |
|
||||
| [write](/v2.0/reference/cli/influx/write) | Write points to InfluxDB |
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
---
|
||||
title: influx apply
|
||||
description: The 'influx apply' command applies InfluxDB templates.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx apply
|
||||
parent: influx
|
||||
weight: 101
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx apply` command applies InfluxDB templates.
|
||||
_For information about finding and using InfluxDB templates, see
|
||||
[Use InfluxDB templates](/v2.0/influxdb-templates/use/)._
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx apply [flags]
|
||||
```
|
||||
|
||||
#### Aliases
|
||||
`apply`, `pkg` _(deprecated)_
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:----------------------------- |:---------- |:------------------ |
|
||||
| `-c`, `--disable-color` | Disable color in output | | |
|
||||
| `--disable-table-borders` | Disable table borders | | |
|
||||
| `-e`, `--encoding` | Encoding of the input stream | string | |
|
||||
| `--env-ref` | Environment references to provide with the template (format: `--env-ref=REF_KEY=REF_VALUE`) | string | |
|
||||
| `-f`, `--file` | Path to template file | string | |
|
||||
| `--force` | Ignore warnings about destructive changes | | |
|
||||
| `-h`, `--help` | Help for the `apply` command | | |
|
||||
| `--json` | Output data as JSON | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-o`, `--org` | Organization name that owns the bucket | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID that owns the bucket | string | `INFLUX_ORG_ID` |
|
||||
| `-q`, `--quiet` | Disable output printing | | |
|
||||
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
|
||||
| `--secret` | Secrets to provide with the template (format: `--secret=SECRET_KEY=SECRET_VALUE`) | string | |
|
||||
| `--stack-id` | Stack ID to associate when applying the template | string | |
|
||||
| `-u`, `--template-url` | URL of template file | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
||||
## Examples
|
||||
```sh
|
||||
# Apply a template from a file.
|
||||
influx apply -f path/to/template.json
|
||||
|
||||
# Apply a stack that has associated templates.
|
||||
influx apply --stack-id $STACK_ID
|
||||
|
||||
# Apply a template associated with a stack.
|
||||
# Stacks make template application idempotent.
|
||||
influx apply -f path/to/template.json --stack-id $STACK_ID
|
||||
|
||||
# Apply multiple template files together.
|
||||
influx apply \
|
||||
-f path/to/template_1.json \
|
||||
-f path/to/template_2.yml
|
||||
|
||||
# Apply a template from a URL.
|
||||
influx apply -u https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
|
||||
|
||||
# Apply a template from STDIN.
|
||||
cat template.json | influx apply --encoding json
|
||||
|
||||
# Apply all templates in a directory.
|
||||
influx apply -f path/to/template_directory
|
||||
|
||||
# Recurse through a directory and its subdirectories and apply all templates.
|
||||
influx apply -R -f path/to/template_directory
|
||||
|
||||
# Apply templates from multiple sources – directory, file, and URL.
|
||||
influx apply \
|
||||
-f path/to/template.yml
|
||||
-f path/to/templates_directory
|
||||
-u https://example.com/template.json
|
||||
```
|
|
@ -1,28 +1,31 @@
|
|||
---
|
||||
title: influx pkg export
|
||||
description: The 'influx pkg' command exports existing resources as an InfluxDB template.
|
||||
title: influx export
|
||||
description: The 'influx export' command exports existing resources as an InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx pkg
|
||||
parent: influx
|
||||
weight: 101
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/export/
|
||||
related:
|
||||
- /v2.0/influxdb-templates/create/
|
||||
---
|
||||
|
||||
The `influx pkg export` command exports existing resources as an InfluxDB template.
|
||||
The `influx export` command exports existing resources as an InfluxDB template.
|
||||
_For detailed examples of exporting InfluxDB templates, see
|
||||
[Create an InfluxDB template](/v2.0/influxdb-templates/create/)._
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg export [flags]
|
||||
influx pkg export [command]
|
||||
influx export [flags]
|
||||
influx export [command]
|
||||
```
|
||||
|
||||
## Available subcommands
|
||||
| Subcommand | Description |
|
||||
|:---------- |:----------- |
|
||||
| [all](/v2.0/reference/cli/influx/pkg/export/all/) | Export all resources in an organization as a template |
|
||||
| Subcommand | Description |
|
||||
|:---------- |:----------- |
|
||||
| [all](/v2.0/reference/cli/influx/export/all/) | Export all resources in an organization as a template |
|
||||
| [stack](/v2.0/reference/cli/influx/export/stack/) | Export all resources associated with a stack as a template |
|
||||
|
||||
## Flags
|
||||
|
||||
|
@ -42,3 +45,15 @@ influx pkg export [command]
|
|||
| `--variables` | Comma-separated list of variable IDs | string |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
||||
## Examples
|
||||
```sh
|
||||
# Export buckets by ID
|
||||
influx export --buckets=$ID1,$ID2,$ID3
|
||||
|
||||
# Export buckets, labels, and dashboards by ID
|
||||
influx export \
|
||||
--buckets=$BID1,$BID2,$BID3 \
|
||||
--labels=$LID1,$LID2,$LID3 \
|
||||
--dashboards=$DID1,$DID2,$DID3
|
||||
```
|
|
@ -1,23 +1,25 @@
|
|||
---
|
||||
title: influx pkg export all
|
||||
title: influx export all
|
||||
description: >
|
||||
The 'influx pkg' command exports all resources in an organization as an InfluxDB template.
|
||||
The 'influx export all' command exports all resources in an organization as an InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx pkg export
|
||||
parent: influx export
|
||||
weight: 201
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/export/all/
|
||||
related:
|
||||
- /v2.0/influxdb-templates/create/
|
||||
---
|
||||
|
||||
The `influx pkg export all` command exports all resources in an
|
||||
The `influx export all` command exports all resources in an
|
||||
organization as an InfluxDB template.
|
||||
_For detailed examples of exporting InfluxDB templates, see
|
||||
[Create an InfluxDB template](/v2.0/influxdb-templates/create/)._
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg export all [flags]
|
||||
influx export all [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
|
@ -25,8 +27,35 @@ influx pkg export all [flags]
|
|||
|:---- |:----------- |:---------- |:------------------ |
|
||||
| `-f`, `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | |
|
||||
| `--filter` | Specify resources to export by labelName or resourceKind (format: `--filter=labelName=example`) | list of strings |
|
||||
| `-h`, `--help` | Help for the `export` command | | |
|
||||
| `-h`, `--help` | Help for the `export all` command | | |
|
||||
| `-o`, `--org` | Organization name that owns the resources | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID that owns the resources | string | `INFLUX_ORG_ID` |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
||||
## Examples
|
||||
```sh
|
||||
# Export all resources in an organization as a template
|
||||
influx export all --org $INFLUX_ORG
|
||||
|
||||
# Export all bucket resources as a template
|
||||
influx export all --org $INFLUX_ORG --filter=resourceKind=Bucket
|
||||
|
||||
# Export all resources associated with label Foo
|
||||
influx export all --org $INFLUX_ORG --filter=labelName=Foo
|
||||
|
||||
# Export all bucket resources and filter by label Foo
|
||||
influx export all --org $INFLUX_ORG \
|
||||
--filter=resourceKind=Bucket \
|
||||
--filter=labelName=Foo
|
||||
|
||||
# Export all bucket or dashboard resources and filter by label Foo.
|
||||
#
|
||||
# Note: "like" filters are unioned and filter types are intersections.
|
||||
# For example, the following will export a resource if it is a dashboard or
|
||||
# bucket and has an associated label of Foo.
|
||||
influx export all --org $INFLUX_ORG \
|
||||
--filter=resourceKind=Bucket \
|
||||
--filter=resourceKind=Dashboard \
|
||||
--filter=labelName=Foo
|
||||
``
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: influx export stack
|
||||
description: >
|
||||
The 'influx export stack' command exports all resources associated with a stack as an InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx export
|
||||
weight: 201
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/export/stack
|
||||
---
|
||||
|
||||
The `influx export stack` command exports all resources associated with a stack as a template.
|
||||
All `metadata.name` fields remain the same.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx export stack <stack_id> [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:---------- |:------------------ |
|
||||
| `-f`, `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | |
|
||||
| `-h`, `--help` | Help for the `export stack` command | | |
|
||||
| `-o`, `--org` | Organization name that owns the resources | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID that owns the resources | string | `INFLUX_ORG_ID` |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
||||
## Examples
|
||||
```sh
|
||||
# Export a stack as a template
|
||||
influx export stack $STACK_ID
|
||||
```
|
|
@ -1,50 +0,0 @@
|
|||
---
|
||||
title: influx pkg
|
||||
description: The 'influx pkg' command and its subcommands manage InfluxDB templates.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx pkg
|
||||
parent: influx
|
||||
weight: 101
|
||||
v2.0/tags: [templates]
|
||||
related:
|
||||
- /v2.0/influxdb-templates/use/
|
||||
---
|
||||
|
||||
The `influx pkg` command manages InfluxDB templates.
|
||||
_For information about finding and using InfluxDB templates, see
|
||||
[Use InfluxDB templates](/v2.0/influxdb-templates/use/)._
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg [flags]
|
||||
influx pkg [command]
|
||||
```
|
||||
|
||||
## Subcommands
|
||||
| Subcommand | Description |
|
||||
|:------- |:----------- |
|
||||
| [export](/v2.0/reference/cli/influx/pkg/export/) | Export resources as a template |
|
||||
| [stack](/v2.0/reference/cli/influx/pkg/stack/) | Manage stacks |
|
||||
| [summary](/v2.0/reference/cli/influx/pkg/summary/) | Summarize the specified template |
|
||||
| [validate](/v2.0/reference/cli/influx/pkg/validate/) | Validate the specified template |
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:----------------------------- |:---------- |:------------------ |
|
||||
| `-c`, `--disable-color` | Disable color in output | | |
|
||||
| `--disable-table-borders` | Disable table borders | | |
|
||||
| `-e`, `--encoding` | Encoding of the input stream | string | |
|
||||
| `--env-ref` | Environment references to provide with the template (format: `--env-ref=REF_KEY=REF_VALUE`) | string | |
|
||||
| `-f`, `--file` | Path to template file | string | |
|
||||
| `--force` | Ignore warnings about destructive changes | | |
|
||||
| `-h`, `--help` | Help for the `pkg` command | | |
|
||||
| `-o`, `--org` | Organization name that owns the bucket | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID that owns the bucket | string | `INFLUX_ORG_ID` |
|
||||
| `-q`, `--quiet` | Disable output printing | | |
|
||||
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
|
||||
| `--secret` | Secrets to provide with the template (format: `--secret=SECRET_KEY=SECRET_VALUE`) | string | |
|
||||
| `-u`, `--url` | URL of template file | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
title: influx pkg stack
|
||||
description: The 'influx pkg stack' command and its subcommands manage InfluxDB stacks.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx pkg stack
|
||||
parent: influx pkg
|
||||
weight: 101
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx pkg stack` command manages InfluxDB stacks.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg stack [flags]
|
||||
influx pkg stack [command]
|
||||
```
|
||||
|
||||
## Subcommands
|
||||
| Subcommand | Description |
|
||||
|:------- |:----------- |
|
||||
| [init](/v2.0/reference/cli/influx/pkg/stack/init/) | Initialize a stack |
|
||||
| [list](/v2.0/reference/cli/influx/pkg/stack/list/) | List stacks |
|
||||
| [remove](/v2.0/reference/cli/influx/pkg/stack/remove/) | Remove a stack |
|
||||
|
||||
## Flags
|
||||
| Flag | Description |
|
||||
|:---- |:----------- |
|
||||
| `-h`, `--help` | Help for the `stack` command |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
title: influx pkg stack init
|
||||
description: The 'influx pkg stack init' command initializes an InfluxDB stack.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx pkg stack init
|
||||
parent: influx pkg stack
|
||||
weight: 201
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx pkg stack init` command initializes an InfluxDB stack.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg stack init [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------: |:------------------ |
|
||||
| `-h`, `--help` | Help for the `init` command | | |
|
||||
| `--hide-headers` | Hide table headers (default `false`) | | `INFLUX_HIDE_HEADERS` |
|
||||
| `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-u`, `--package-url` | Package URLs to associate stack | list of strings | |
|
||||
| `-d`, `--stack-description` | Stack description | string | |
|
||||
| `-n`, `--stack-name` | Stack name | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
title: influx pkg validate
|
||||
description: >
|
||||
The 'influx pkg validate' command validates the provided InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx pkg
|
||||
weight: 101
|
||||
---
|
||||
|
||||
The `influx pkg validate` command validates the provided InfluxDB template.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg validate [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:---------- |:------------------ |
|
||||
| `-e`, `--encoding` | Encoding of the input stream | string | |
|
||||
| `-f`, `--file` | Package file to validate | string | |
|
||||
| `-h`, `--help` | Help for the `validate` command | | |
|
||||
| `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
|
||||
| `-u`, `--url` | URL of template file to validate | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: influx repl
|
||||
description: >
|
||||
The 'influx repl' command opens and interactive read-eval-print-loop (REPL)
|
||||
The 'influx repl' command opens an interactive read-eval-print-loop (REPL)
|
||||
from which you can run Flux commands.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
|
@ -11,7 +11,7 @@ weight: 101
|
|||
v2.0/tags: [query]
|
||||
---
|
||||
|
||||
The `influx repl` command opens and interactive read-eval-print-loop (REPL)
|
||||
The `influx repl` command opens an interactive read-eval-print-loop (REPL)
|
||||
from which you can run Flux commands.
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -1,29 +1,37 @@
|
|||
---
|
||||
title: influx pkg stack list
|
||||
title: influx stacks
|
||||
description: >
|
||||
The 'influx pkg stack list' command lists InfluxDB stacks and associated resources.
|
||||
The 'influx stacks' command and its subcommands list and manage InfluxDB stacks
|
||||
and associated resources.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx pkg stack list
|
||||
parent: influx pkg stack
|
||||
weight: 201
|
||||
name: influx stacks
|
||||
parent: influx
|
||||
weight: 101
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/stack/list/
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx pkg stack list` command lists InfluxDB stacks and associated resources.
|
||||
The `influx stacks` command and its subcommands list and manage InfluxDB stacks
|
||||
and associated resources.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg stack list [flags]
|
||||
influx stacks [flags]
|
||||
influx stacks [command]
|
||||
```
|
||||
|
||||
#### Aliases
|
||||
`list`, `ls`
|
||||
## Subcommands
|
||||
| Subcommand | Description |
|
||||
|:------- |:----------- |
|
||||
| [init](/v2.0/reference/cli/influx/stacks/init/) | Initialize a stack |
|
||||
| [remove](/v2.0/reference/cli/influx/stacks/remove/) | Remove a stack |
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------: |:------------------ |
|
||||
| `-h`, `--help` | Help for the `list` command | | |
|
||||
| `-h`, `--help` | Help for the `stacks` command | | |
|
||||
| `--hide-headers` | Hide table headers (default `false`) | | `INFLUX_HIDE_HEADERS` |
|
||||
| `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: influx stacks init
|
||||
description: The 'influx stacks init' command initializes an InfluxDB stack.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx stacks init
|
||||
parent: influx stacks
|
||||
weight: 201
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/stack/init/
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx stacks init` command initializes an InfluxDB stack.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx stacks init [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------: |:------------------ |
|
||||
| `-h`, `--help` | Help for the `init` command | | |
|
||||
| `--hide-headers` | Hide table headers (default `false`) | | `INFLUX_HIDE_HEADERS` |
|
||||
| `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-d`, `--stack-description` | Stack description | string | |
|
||||
| `-n`, `--stack-name` | Stack name | string | |
|
||||
| `-u`, `--template-url` | Template URLs to associate with a stack | list of strings | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
||||
## Examples
|
||||
```sh
|
||||
# Initialize a stack with a name and description
|
||||
influx stack init -n $STACK_NAME -d $STACK_DESCRIPTION
|
||||
|
||||
# Initialize a stack with a name and urls to associate with stack.
|
||||
influx stack init -n $STACK_NAME -u $PATH_TO_TEMPLATE
|
||||
```
|
|
@ -1,19 +1,21 @@
|
|||
---
|
||||
title: influx pkg stack remove
|
||||
description: The 'influx pkg stack remove' command removes an InfluxDB stack.
|
||||
title: influx stacks remove
|
||||
description: The 'influx stacks remove' command removes an InfluxDB stack and all associated resources.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: influx pkg stack remove
|
||||
parent: influx pkg stack
|
||||
name: influx stacks remove
|
||||
parent: influx stacks
|
||||
weight: 201
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/stack/remove/
|
||||
v2.0/tags: [templates]
|
||||
---
|
||||
|
||||
The `influx pkg stack remove` command removes an InfluxDB stack.
|
||||
The `influx stacks remove` command removes an InfluxDB stack and all associated resources.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg stack remove [flags]
|
||||
influx stacks remove [flags]
|
||||
```
|
||||
|
||||
#### Aliases
|
|
@ -1,32 +1,39 @@
|
|||
---
|
||||
title: influx pkg summary
|
||||
description: >
|
||||
The 'influx pkg summary' command summarizes the provided InfluxDB template.
|
||||
title: influx template
|
||||
description: The 'influx template' command summarizes the specified InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx pkg
|
||||
name: influx template
|
||||
parent: influx
|
||||
weight: 101
|
||||
v2.0/tags: [templates]
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/summary/
|
||||
---
|
||||
|
||||
The `influx pkg summary` command summarizes the provided InfluxDB template.
|
||||
The `influx template` command summarizes the specified InfluxDB template.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx pkg summary [flags]
|
||||
influx template [flags]
|
||||
influx template [command]
|
||||
```
|
||||
|
||||
## Flags
|
||||
## Subcommands
|
||||
| Subcommand | Description |
|
||||
|:---------- |:----------- |
|
||||
| [validate](/v2.0/reference/cli/influx/template/validate) | Validate a template |
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:---------- |:------------------ |
|
||||
| `-c`, `--disable-color` | Disable color in output | | |
|
||||
| `--disable-table-borders` | Disable table borders | | |
|
||||
| `-e`, `--encoding` | Encoding of the input stream | string | |
|
||||
| `-f`, `--file` | Package file to summarize | string | |
|
||||
| `-h`, `--help` | Help for the `summary` command | | |
|
||||
| `-f`, `--file` | Template file to summarize | string | |
|
||||
| `-h`, `--help` | Help for the `template` command | | |
|
||||
| `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
|
||||
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
|
||||
| `-u`, `--url` | URL of template file to summarize | string | |
|
||||
|
||||
| `-u`, `--template-url` | URL of template file to summarize | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: influx template validate
|
||||
description: >
|
||||
The 'influx template validate' command validates the provided InfluxDB template.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
parent: influx template
|
||||
weight: 201
|
||||
aliases:
|
||||
- /v2.0/reference/cli/influx/pkg/validate/
|
||||
---
|
||||
|
||||
The `influx template validate` command validates the provided InfluxDB template.
|
||||
|
||||
## Usage
|
||||
```
|
||||
influx template validate [flags]
|
||||
```
|
||||
|
||||
## Flags
|
||||
|
||||
| Flag | | Description | Input Type |
|
||||
|:---- | --- |:----------- |:---------- |
|
||||
| `-e` | `--encoding` | Encoding of the input stream | string |
|
||||
| `-f` | `--file` | Template file to validate | string |
|
||||
| `-h` | `--help` | Help for the `validate` command | |
|
||||
| `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | |
|
||||
| `-u` | `--template-url` | URL of template file to validate | string |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
|
@ -9,6 +9,9 @@ menu:
|
|||
parent: influx
|
||||
weight: 101
|
||||
v2.0/tags: [write]
|
||||
related:
|
||||
- /v2.0/write-data/
|
||||
- /v2.0/write-data/csv/
|
||||
---
|
||||
|
||||
The `influx write` command writes data to InfluxDB via stdin or from a specified file.
|
||||
|
@ -27,15 +30,21 @@ influx write [command]
|
|||
| [dryrun](/v2.0/reference/cli/influx/write/dryrun) | Write to stdout instead of InfluxDB |
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------:|:------------------ |
|
||||
| `-b`, `--bucket` | Bucket name | string | `INFLUX_BUCKET_NAME` |
|
||||
| `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
|
||||
| `-f`, `--file` | File to import | string | |
|
||||
| `--format` | Input format (`lp` or `csv`, default `lp`) | string | |
|
||||
| `-h`, `--help` | Help for the `dryrun` command | | |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-p`, `--precision` | Precision of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------:|:------------------ |
|
||||
| `-b`, `--bucket` | Bucket name | string | `INFLUX_BUCKET_NAME` |
|
||||
| `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
|
||||
| `--debug` | Output errors to stderr | | |
|
||||
| `--encoding` | Character encoding of input (default `UTF-8`) | string | |
|
||||
| `-f`, `--file` | File to import | string | |
|
||||
| `--format` | Input format (`lp` or `csv`, default `lp`) | string | |
|
||||
| `--header` | Prepend header line to CSV input data | string | |
|
||||
| `-h`, `--help` | Help for the `dryrun` command | | |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-p`, `--precision` | Precision of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
|
||||
| `--skipHeader` | Skip first n rows of input data | integer | |
|
||||
| `--skipRowOnError` | Output CSV errors to stderr, but continue processing | | |
|
||||
| `-u`, `--url` | URL to import data from | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
|
|
@ -24,15 +24,21 @@ influx write dryrun [flags]
|
|||
```
|
||||
|
||||
## Flags
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------:|:------------------ |
|
||||
| `-b`, `--bucket` | Bucket name | string | `INFLUX_BUCKET_NAME` |
|
||||
| `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
|
||||
| `-f`, `--file` | File to import | string | |
|
||||
| `--format` | Input format (`lp` or `csv`, defaults `lp`) | string | |
|
||||
| `-h`, `--help` | Help for the `dryrun` command | | |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-p`, `--precision` | Precision of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
|
||||
| Flag | Description | Input type | {{< cli/mapped >}} |
|
||||
|:---- |:----------- |:----------:|:------------------ |
|
||||
| `-b`, `--bucket` | Bucket name | string | `INFLUX_BUCKET_NAME` |
|
||||
| `--bucket-id` | Bucket ID | string | `INFLUX_BUCKET_ID` |
|
||||
| `--debug` | Output errors to stderr | | |
|
||||
| `--encoding` | Character encoding of input (default `UTF-8`) | string | |
|
||||
| `-f`, `--file` | File to import | string | |
|
||||
| `--format` | Input format (`lp` or `csv`, default `lp`) | string | |
|
||||
| `--header` | Prepend header line to CSV input data | string | |
|
||||
| `-h`, `--help` | Help for the `dryrun` command | | |
|
||||
| `-o`, `--org` | Organization name | string | `INFLUX_ORG` |
|
||||
| `--org-id` | Organization ID | string | `INFLUX_ORG_ID` |
|
||||
| `-p`, `--precision` | Precision of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
|
||||
| `--skipHeader` | Skip first n rows of input data | integer | |
|
||||
| `--skipRowOnError` | Output CSV errors to stderr, but continue processing | | |
|
||||
| `-u`, `--url` | URL to import data from | string | |
|
||||
|
||||
{{% cli/influx-global-flags %}}
|
||||
|
|
|
@ -90,9 +90,18 @@ Durations can be added to times to produce a new time.
|
|||
|
||||
##### Examples of duration types
|
||||
```js
|
||||
2018-07-01T00:00:00Z + 1mo // 2018-08-01T00:00:00Z
|
||||
2018-07-01T00:00:00Z + 2y // 2020-07-01T00:00:00Z
|
||||
2018-07-01T00:00:00Z + 5h // 2018-07-01T05:00:00Z
|
||||
1ns // 1 nanosecond
|
||||
1us // 1 microsecond
|
||||
1ms // 1 millisecond
|
||||
1s // 1 second
|
||||
1m // 1 minute
|
||||
1h // 1 hour
|
||||
1d // 1 day
|
||||
1w // 1 week
|
||||
1mo // 1 calendar month
|
||||
1y // 1 calendar year
|
||||
|
||||
3d12h4m25s // 3 days, 12 hours, 4 minutes, and 25 seconds
|
||||
```
|
||||
|
||||
### String types
|
||||
|
|
|
@ -11,8 +11,8 @@ menu:
|
|||
weight: 501
|
||||
related:
|
||||
- /v2.0/query-data/flux/window-aggregate/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations – InfluxQL – Aggregate functions
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause – InfluxQL – GROUP BY time()
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations, InfluxQL – Aggregate functions
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/explore-data/#the-group-by-clause, InfluxQL – GROUP BY time()
|
||||
---
|
||||
|
||||
The `aggregateWindow()` function applies an aggregate or selector function
|
||||
|
@ -49,6 +49,12 @@ Make sure `fn` parameter names match each specified parameter. To learn why, see
|
|||
|
||||
The duration of windows.
|
||||
|
||||
{{% note %}}
|
||||
#### Calendar months and years
|
||||
`every` supports all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
|
||||
including **calendar months (`1mo`)** and **years (`1y`)**.
|
||||
{{% /note %}}
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### fn
|
||||
|
@ -91,31 +97,35 @@ Defaults to `true`.
|
|||
_**Data type:** Boolean_
|
||||
|
||||
## Examples
|
||||
|
||||
###### Using an aggregate function with default parameters
|
||||
The examples below use a `data` variable to represent a filtered data set.
|
||||
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: 1h)
|
||||
data = from(bucket: "example-bucket")
|
||||
|> range(start: -1h)
|
||||
|> filter(fn: (r) =>
|
||||
r._measurement == "mem" and
|
||||
r._field == "used_percent")
|
||||
```
|
||||
|
||||
##### Use an aggregate function with default parameters
|
||||
The following example uses the default parameters of the
|
||||
[`mean()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/mean/)
|
||||
to aggregate time-based windows:
|
||||
|
||||
```js
|
||||
data
|
||||
|> aggregateWindow(
|
||||
every: 5m,
|
||||
fn: mean
|
||||
)
|
||||
```
|
||||
###### Specify parameters of the aggregate function
|
||||
##### Specify parameters of the aggregate function
|
||||
To use functions that don't provide defaults for required parameters with `aggregateWindow()`,
|
||||
define an anonymous function with `column` and `tables` parameters that pipe-forward
|
||||
define an anonymous function with `column` and `tables` parameters that pipes-forward
|
||||
tables into the aggregate or selector function with all required parameters defined:
|
||||
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: 1h)
|
||||
|> filter(fn: (r) =>
|
||||
r._measurement == "mem" and
|
||||
r._field == "used_percent")
|
||||
data
|
||||
|> aggregateWindow(
|
||||
column: "_value",
|
||||
every: 5m,
|
||||
|
@ -123,6 +133,12 @@ from(bucket: "example-bucket")
|
|||
)
|
||||
```
|
||||
|
||||
##### Window and aggregate by calendar month
|
||||
```js
|
||||
data
|
||||
|> aggregateWindow(every: 1mo, fn: mean)
|
||||
```
|
||||
|
||||
## Function definition
|
||||
|
||||
```js
|
||||
|
|
|
@ -86,24 +86,12 @@ identity: {sum: 0.0, count: 0.0}
|
|||
|
||||
## Important notes
|
||||
|
||||
#### Preserve columns
|
||||
#### Dropped columns
|
||||
By default, `reduce()` drops any columns that:
|
||||
|
||||
1. Are not part of the input table's group key.
|
||||
1. Are not part of the input table's [group key](/v2.0/reference/glossary/#group-key).
|
||||
2. Are not explicitly mapped in the `reduce()` function.
|
||||
|
||||
This often results in the `_time` column being dropped.
|
||||
To preserve the `_time` column and other columns that do not meet the criteria above,
|
||||
use the `with` operator to map values in the `r` object.
|
||||
The `with` operator updates a column if it already exists,
|
||||
creates a new column if it doesn't exist, and includes all existing columns in
|
||||
the output table.
|
||||
|
||||
```js
|
||||
reduce(fn: (r) => ({ r with newColumn: r._value * 2 }))
|
||||
```
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
##### Compute the sum of the value column
|
||||
|
@ -157,14 +145,13 @@ from(bucket:"example-bucket")
|
|||
)
|
||||
```
|
||||
|
||||
##### Calculate the average and preserve existing columns
|
||||
##### Calculate the average
|
||||
```js
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
||||
|> filter(fn: (r) => r._measurement == "mem" and r._field == "used_percent")
|
||||
|> window(every: 5m)
|
||||
|> reduce(fn: (r, accumulator) => ({
|
||||
r with
|
||||
count: accumulator.count + 1,
|
||||
total: accumulator.total + r._value,
|
||||
avg: (accumulator.total + r._value) / float(v: accumulator.count)
|
||||
|
|
|
@ -11,7 +11,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: columns
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL – SHOW MEASUREMENTS
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL – SHOW FIELD KEYS
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: cumulativeSum
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/cumulativesum/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#cumulative-sum, InfluxQL – CUMULATIVE_SUM()
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: drop
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `drop()` function removes specified columns from a table.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: duplicate
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `duplicate()` function duplicates a specified column in a table.
|
||||
|
|
|
@ -7,7 +7,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: elapsed
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `elapsed()` function returns the time between subsequent records.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: fill
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/fill/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#group-by-time-intervals-and-fill, InfluxQL – FILL
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: filter
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
v2.0/tags: [exists]
|
||||
related:
|
||||
- /v2.0/query-data/flux/query-fields/
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: group
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/group-data/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL – GROUP BY
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: histogram
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/histograms/
|
||||
---
|
||||
|
|
|
@ -10,7 +10,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: hourSelection
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `hourSelection()` function retains all rows with time values in a specified hour range.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: join
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/join/
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/union/
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: keep
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `keep()` function returns a table containing only the specified columns, ignoring all others.
|
||||
|
|
|
@ -11,7 +11,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: keys
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL – SHOW MEASUREMENTS
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL – SHOW FIELD KEYS
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: keyValues
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL – SHOW MEASUREMENTS
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL – SHOW FIELD KEYS
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: limit
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/sort-limit/
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/tail/
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: map
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
v2.0/tags: [exists]
|
||||
related:
|
||||
- /v2.0/query-data/flux/conditional-logic/
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: pivot
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `pivot()` function collects values stored vertically (column-wise) in a table
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: range
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-where-clause, InfluxQL – WHERE
|
||||
---
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: rename
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `rename()` function renames specified columns in a table.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: set
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `set()` function assigns a static value to each record in the input table.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: sort
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/sort-limit/
|
||||
---
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: stateCount
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/monitor-states/
|
||||
---
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: stateDuration
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/monitor-states/
|
||||
---
|
||||
|
|
|
@ -20,11 +20,31 @@ related:
|
|||
Use stream and table functions to extract a table from a stream of tables and access its
|
||||
columns and records.
|
||||
|
||||
##### Example stream and table functions
|
||||
{{< children type="functions" >}}
|
||||
|
||||
### Example stream and table functions
|
||||
|
||||
##### Recommended usage
|
||||
```js
|
||||
data = from(bucket:"example-bucket")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn:(r) => r._measurement == "cpu")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn:(r) => r._measurement == "cpu")
|
||||
|
||||
// Extract the "_value" column from the table
|
||||
data
|
||||
|> findColumn(fn: (key) => key._field == "usage_idle", column: "_value")
|
||||
|
||||
// Extract the first record from the table
|
||||
data
|
||||
|> findRecord(fn: (key) => key._field == "usage_idle", idx: 0)
|
||||
|
||||
```
|
||||
|
||||
##### Alternate usage
|
||||
```js
|
||||
data = from(bucket:"example-bucket")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn:(r) => r._measurement == "cpu")
|
||||
|
||||
// Extract the first available table for which "_field" is equal to "usage_idle"
|
||||
t = data |> tableFind(fn: (key) => key._field == "usage_idle")
|
||||
|
@ -35,5 +55,3 @@ values = t |> getColumn(column: "_value")
|
|||
// Extract the first record from the table
|
||||
r0 = t |> getRecord(idx: 0)
|
||||
```
|
||||
|
||||
{{< children type="functions" >}}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
title: findColumn() function
|
||||
description: >
|
||||
The `findColumn()` function returns an array of values in a specified column from the
|
||||
first table in a stream of tables where group key values match the specified predicate.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: findColumn
|
||||
parent: Stream & table
|
||||
weight: 501
|
||||
related:
|
||||
- /v2.0/query-data/flux/scalar-values/
|
||||
---
|
||||
|
||||
The `findColumn()` function returns an array of values in a specified column from the
|
||||
first table in a stream of tables where the group key values match the specified predicate.
|
||||
The function returns an empty array if no table is found or if the column label
|
||||
is not present in the set of columns.
|
||||
|
||||
_**Function type:** Stream and table_
|
||||
|
||||
```js
|
||||
findColumn(
|
||||
fn: (key) => key._field == "fieldName")
|
||||
column: "_value"
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### fn
|
||||
A predicate function for matching keys in a table's group key.
|
||||
Expects a `key` argument that represents a group key in the input stream.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
### column
|
||||
Name of the column to extract.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Example
|
||||
```js
|
||||
vs = from(bucket:"example-bucket")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn:(r) => r._measurement == "cpu")
|
||||
|> findColumn(
|
||||
fn: (key) => key._field == "usage_idle",
|
||||
column: "_value"
|
||||
)
|
||||
|
||||
// Use column values
|
||||
x = vs[0] + vs[1]
|
||||
```
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
title: findRecord() function
|
||||
description: >
|
||||
The `findRecord()` function returns a record at a specified index from the first
|
||||
table in a stream of tables where the group key values match the specified predicate.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: findRecord
|
||||
parent: Stream & table
|
||||
weight: 501
|
||||
related:
|
||||
- /v2.0/query-data/flux/scalar-values/
|
||||
---
|
||||
|
||||
The `findRecord()` function returns a record at a specified index from the first
|
||||
table in a stream of tables where the group key values match the specified predicate.
|
||||
The function returns an empty object if no table is found or if the index is out of bounds.
|
||||
|
||||
_**Function type:** Stream and table_
|
||||
|
||||
```js
|
||||
findRecord(
|
||||
fn: (key) => key._field == "fieldName",
|
||||
idx: 0
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### fn
|
||||
A predicate function for matching keys in a table's group key.
|
||||
Expects a `key` argument that represents a group key in the input stream.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
### idx
|
||||
Index of the record to extract.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
## Example
|
||||
```js
|
||||
r0 = from(bucket:"example-bucket")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn:(r) => r._measurement == "cpu")
|
||||
|> tableFind()
|
||||
|> findRecord(
|
||||
fn: (key) => key._field == "usage_idle",
|
||||
idx: 0
|
||||
)
|
||||
|
||||
// Use record values
|
||||
x = r0._field + "--" + r0._measurement
|
||||
```
|
|
@ -33,7 +33,7 @@ to extract a single table from a stream of tables.
|
|||
## Parameters
|
||||
|
||||
### column
|
||||
The name of the column to extract.
|
||||
Name of the column to extract.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ to extract a single table from a stream of tables.
|
|||
## Parameters
|
||||
|
||||
### idx
|
||||
The index of the record to extract.
|
||||
Index of the record to extract.
|
||||
|
||||
_**Data type:** Integer_
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-mod
|
|||
|
||||
A predicate function for matching keys in a table's group key.
|
||||
`tableFind` returns the first table that resolves as `true`.
|
||||
It expects a `key` argument which represents a group key in the input stream.
|
||||
Expects a `key` argument that represents a group key in the input stream.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: tail
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/reference/flux/functions/built-in/transformations/limit/
|
||||
---
|
||||
|
|
|
@ -9,7 +9,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: timeShift
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
---
|
||||
|
||||
The `timeShift()` function adds a fixed duration to time columns.
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: truncateTimeColumn
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/reference/flux/stdlib/date/truncate/
|
||||
---
|
||||
|
|
|
@ -8,7 +8,7 @@ menu:
|
|||
v2_0_ref:
|
||||
name: union
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/join/
|
||||
---
|
||||
|
|
|
@ -8,9 +8,10 @@ menu:
|
|||
v2_0_ref:
|
||||
name: window
|
||||
parent: built-in-transformations
|
||||
weight: 401
|
||||
weight: 402
|
||||
related:
|
||||
- /v2.0/query-data/flux/window-aggregate/
|
||||
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL – GROUP BY time()
|
||||
---
|
||||
|
||||
|
@ -36,22 +37,14 @@ window(
|
|||
stopColumn: "_stop",
|
||||
createEmpty: false
|
||||
)
|
||||
|
||||
// OR
|
||||
|
||||
window(
|
||||
intervals: intervals(every: 5m, period: 5m, offset: 12h),
|
||||
timeColumn: "_time",
|
||||
startColumn: "_start",
|
||||
stopColumn: "_stop",
|
||||
createEmpty: false
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
{{% note %}}
|
||||
`every`,`period` or `intervals` is required.
|
||||
#### Calendar months and years
|
||||
`every`, `period`, and `offset` support all [valid duration units](/v2.0/reference/flux/language/types/#duration-types),
|
||||
including **calendar months (`1mo`)** and **years (`1y`)**.
|
||||
{{% /note %}}
|
||||
|
||||
### every
|
||||
|
@ -75,20 +68,6 @@ Defaults to 0, which will align window end boundaries with the `every` duration.
|
|||
|
||||
_**Data type:** Duration_
|
||||
|
||||
### intervals
|
||||
A function that returns an interval generator, a set of intervals used as windows.
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
###### Example interval generator function
|
||||
```js
|
||||
intervals(every:1d, period:8h, offset:9h)
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
When `intervals` is used, `every`, `period`, and `start` cannot be used or need to be set to 0.
|
||||
{{% /note %}}
|
||||
|
||||
### timeColumn
|
||||
The column containing time.
|
||||
Defaults to `"_time"`.
|
||||
|
@ -118,15 +97,15 @@ _**Data type:** Boolean_
|
|||
#### Window data into 10 minute intervals
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start:-12h)
|
||||
|> window(every:10m)
|
||||
|> range(start: -12h)
|
||||
|> window(every: 10m)
|
||||
// ...
|
||||
```
|
||||
|
||||
#### Window data using intervals function
|
||||
The following windows data into 8 hour intervals starting at 9AM every day.
|
||||
#### Window by calendar month
|
||||
```js
|
||||
from(bucket:"example-bucket")
|
||||
|> range(start:-12h)
|
||||
|> window(intervals: intervals(every:1d, period:8h, offset:9h))
|
||||
|> range(start: -1y)
|
||||
|> window(every: 1mo)
|
||||
// ...
|
||||
```
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Flux user-contributed functions
|
||||
list_title: User-contributed functions
|
||||
description: >
|
||||
User-contributed packages and functions are contributed and maintained by members of the InfluxDB and Flux communities.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: User-contributed
|
||||
parent: Flux standard library
|
||||
weight: 202
|
||||
v2.0/tags: [contributed, functions, package]
|
||||
---
|
||||
|
||||
User-contributed packages and functions are contributed and maintained by members of the InfluxDB and Flux communities.
|
||||
|
||||
{{< children >}}
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Flux Discord package
|
||||
list_title: Discord package
|
||||
description: >
|
||||
The Flux Discord package provides functions for sending data to Discord.
|
||||
Import the `contrib/chobbs/discord` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: Discord
|
||||
parent: User-contributed
|
||||
weight: 202
|
||||
v2.0/tags: [functions, discord, package]
|
||||
---
|
||||
|
||||
The Flux Discord package provides functions for sending data to Discord.
|
||||
Import the `contrib/chobbs/discord` package:
|
||||
|
||||
```js
|
||||
import "contrib/chobbs/discord"
|
||||
```
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
||||
|
||||
{{% note %}}
|
||||
#### Package author and maintainer
|
||||
**Github:** [@chobbs](https://github.com/chobbs)
|
||||
**InfluxDB Slack:** [@craig](https://influxdata.com/slack)
|
||||
{{% /note %}}
|
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
title: discord.send() function
|
||||
description: >
|
||||
The `discord.send()` function sends a single message to a Discord channel using
|
||||
a [Discord webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3).
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: discord.send
|
||||
parent: Discord
|
||||
weight: 202
|
||||
---
|
||||
|
||||
The `discord.send()` function sends a single message to a Discord channel using
|
||||
a [Discord webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks&?page=3).
|
||||
|
||||
_**Function type:** Output_
|
||||
|
||||
```js
|
||||
import "contrib/chobbs/discord"
|
||||
|
||||
discord.send(
|
||||
webhookToken: "mySuPerSecRetTokEn",
|
||||
webhookID: "123456789",
|
||||
username: "username",
|
||||
content: "This is an example message",
|
||||
avatar_url: "https://example.com/avatar_pic.jpg"
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### webhookToken
|
||||
Discord [webhook token](https://discord.com/developers/docs/resources/webhook).
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### webhookID
|
||||
Discord [webhook ID](https://discord.com/developers/docs/resources/webhook).
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### username
|
||||
Override the Discord webhook's default username.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### content
|
||||
Message to send to Discord (2000 character limit).
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### avatar_url
|
||||
Override the Discord webhook's default avatar.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
## Examples
|
||||
|
||||
##### Send the last reported status to Discord
|
||||
```js
|
||||
import "contrib/chobbs/discord"
|
||||
import "influxdata/influxdb/secrets"
|
||||
|
||||
token = secrets.get(key: "DISCORD_TOKEN")
|
||||
|
||||
lastReported =
|
||||
from(bucket: "example-bucket")
|
||||
|> range(start: -1m)
|
||||
|> filter(fn: (r) => r._measurement == "statuses")
|
||||
|> last()
|
||||
|> findRecord(fn: (key) => true, idx: 0)
|
||||
|
||||
discord.send(
|
||||
webhookToken:token,
|
||||
webhookID: "1234567890",
|
||||
username: "chobbs",
|
||||
content: "The current status is \"${lastReported.status}\".",
|
||||
avatar_url: "https://staff-photos.net/pic.jpg"
|
||||
)
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
#### Package author and maintainer
|
||||
**Github:** [@chobbs](https://github.com/chobbs)
|
||||
**InfluxDB Slack:** [@craig](https://influxdata.com/slack)
|
||||
{{% /note %}}
|
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
title: experimental.chain() function
|
||||
description: >
|
||||
The `experimental.chain()` function runs two queries in a single Flux script
|
||||
sequentially and outputs the results of the second query.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: experimental.chain
|
||||
parent: Experimental
|
||||
weight: 302
|
||||
---
|
||||
|
||||
The `experimental.chain()` function runs two queries in a single Flux script
|
||||
sequentially and outputs the results of the second query.
|
||||
Flux typically executes multiple queries in a single script in parallel.
|
||||
Running the queries sequentially ensures any dependencies the second query has on
|
||||
the results of the first query are met.
|
||||
|
||||
##### Applicable use cases
|
||||
- Writing to a bucket and querying the written data in a single Flux script or
|
||||
[InfluxDB task](/v2.0/process-data/get-started/).
|
||||
- Execute queries sequentially in testing scenarios.
|
||||
|
||||
_**Function type:** Miscellaneous_
|
||||
|
||||
```js
|
||||
import "experimental"
|
||||
|
||||
experimental.chain(
|
||||
first: query1,
|
||||
second: query2
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### first
|
||||
The first query to execute.
|
||||
|
||||
_**Data type:** Stream of tables_
|
||||
|
||||
### second
|
||||
The second query to execute.
|
||||
|
||||
_**Data type:** Stream of tables_
|
||||
|
||||
## Examples
|
||||
|
||||
### Write to a bucket and query the written data
|
||||
```js
|
||||
import "experimental"
|
||||
|
||||
downsampled_max = from(bucket: "example-bucket-1")
|
||||
|> range(start: -1d)
|
||||
|> filter(fn: (r) => r._measurement == "example-measurement")
|
||||
|> aggregateWindow(every: 1h, fn: max)
|
||||
|> to(bucket: "downsample-1h-max", org: "example-org")
|
||||
|
||||
average_max = from(bucket: "downsample-1h-max")
|
||||
|> range(start: -1d)
|
||||
|> filter(fn: (r) => r.measurement == "example-measurement")
|
||||
|> mean()
|
||||
|
||||
experimental.chain(
|
||||
first: downsampled_max,
|
||||
second: average_max
|
||||
)
|
||||
```
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: Flux Experimental JSON package
|
||||
list_title: JSON package
|
||||
description: >
|
||||
The Flux experimental JSON package provides functions for working with JSON.
|
||||
Import the `experimental/json` package.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: JSON
|
||||
identifier: JSON-exp
|
||||
parent: Experimental
|
||||
weight: 301
|
||||
v2.0/tags: [functions, json, package]
|
||||
---
|
||||
|
||||
Flux experimental JSON functions provide tools for working with JSON.
|
||||
Import the `experimental/json` package:
|
||||
|
||||
```js
|
||||
import "experimental/json"
|
||||
```
|
||||
|
||||
{{< children type="functions" show="pages" >}}
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
title: json.parse() function
|
||||
description: >
|
||||
The `json.parse()` function takes JSON data as bytes and returns a value.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: json.parse
|
||||
parent: JSON-exp
|
||||
weight: 401
|
||||
---
|
||||
|
||||
The `json.parse()` function takes JSON data as bytes and returns a value.
|
||||
The function can return lists, objects, strings, booleans, and float values.
|
||||
All numeric values are returned as floats.
|
||||
|
||||
_**Function type:** Type conversion_
|
||||
|
||||
```js
|
||||
import "experimental/json"
|
||||
|
||||
json.parse(
|
||||
data: bytes(v: "{\"\"a\"\":1,\"\"b\"\":2,\"\"c\"\":3}")
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### data
|
||||
JSON data to parse.
|
||||
|
||||
_**Data type:** Bytes_
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
##### Parse and use JSON data to restructure a table
|
||||
```js
|
||||
import "experimental/json"
|
||||
|
||||
data
|
||||
|> map(fn: (r) => {
|
||||
jsonData = json.parse(data: bytes(v: r._value))
|
||||
|
||||
return {
|
||||
_time: r._time,
|
||||
_field: r._field,
|
||||
a: jsonData.a,
|
||||
b: jsonData.b,
|
||||
c: jsonData.c,
|
||||
}
|
||||
})
|
||||
```
|
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
title: v1.fieldKeys() function
|
||||
description: The `v1.fieldKeys()` function returns field keys in a bucket.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: v1.fieldKeys
|
||||
parent: InfluxDB v1
|
||||
weight: 301
|
||||
v2.0/tags: [fields]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL
|
||||
---
|
||||
|
||||
The `v1.fieldKeys()` function returns field keys in a bucket.
|
||||
The return value is always a single table with a single column, `_value`.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.fieldKeys(
|
||||
bucket: "example-bucket",
|
||||
predicate: (r) => true,
|
||||
start: -30d
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### bucket
|
||||
The bucket to list field keys from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### predicate
|
||||
The predicate function that filters field keys.
|
||||
_Defaults to `(r) => true`._
|
||||
|
||||
_**Data type:** Function_
|
||||
|
||||
### start
|
||||
The oldest time to include in results.
|
||||
_Defaults to `-30d`._
|
||||
|
||||
Relative start times are defined using negative durations.
|
||||
Negative durations are relative to now.
|
||||
Absolute start times are defined using timestamps.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
## Examples
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.fieldKeys(bucket: "my-bucket")
|
||||
```
|
||||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
fieldKeys = (bucket, predicate=(r) => true, start=-30d) =>
|
||||
tagValues(bucket: bucket, tag: "_field", predicate: predicate, start: start)
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
[v1.tagValues](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues/)_
|
|
@ -36,6 +36,8 @@ from(bucket:"example-bucket")
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
fieldsAsCols = (tables=<-) =>
|
||||
tables
|
||||
|> pivot(
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: v1.measurementFieldKeys() function
|
||||
description: The `v1.measurementFieldKeys()` function returns a list of fields in a measurement.
|
||||
menu:
|
||||
v2_0_ref:
|
||||
name: v1.measurementFieldKeys
|
||||
parent: InfluxDB v1
|
||||
weight: 301
|
||||
v2.0/tags: [fields]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL
|
||||
---
|
||||
|
||||
The `v1.measurementFieldKeys()` function returns a list of fields in a measurement.
|
||||
The return value is always a single table with a single column, `_value`.
|
||||
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurementFieldKeys(
|
||||
bucket: "example-bucket",
|
||||
measurement: "example-measurement",
|
||||
start: -30d
|
||||
)
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
### bucket
|
||||
The bucket to list field keys from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### measurement
|
||||
The measurement to list field keys from.
|
||||
|
||||
_**Data type:** String_
|
||||
|
||||
### start
|
||||
The oldest time to include in results.
|
||||
_Defaults to `-30d`._
|
||||
|
||||
Relative start times are defined using negative durations.
|
||||
Negative durations are relative to now.
|
||||
Absolute start times are defined using timestamps.
|
||||
|
||||
_**Data type:** Duration_
|
||||
|
||||
## Examples
|
||||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.measurementFieldKeys(
|
||||
bucket: "telegraf",
|
||||
measurement: "cpu",
|
||||
)
|
||||
```
|
||||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
measurementFieldKeys = (bucket, measurement, start=-30d) =>
|
||||
fieldKeys(bucket: bucket, predicate: (r) => r._measurement == measurement, start: start)
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
[v1.fieldKeys](/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys/)_
|
|
@ -10,6 +10,7 @@ menu:
|
|||
weight: 301
|
||||
v2.0/tags: [measurements]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL
|
||||
---
|
||||
|
||||
|
@ -31,9 +32,11 @@ _**Data type:** String_
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
measurements = (bucket) =>
|
||||
tagValues(bucket: bucket, tag: "_measurement")
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
[tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_
|
||||
[v1.tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_
|
||||
|
|
|
@ -10,6 +10,7 @@ menu:
|
|||
weight: 301
|
||||
v2.0/tags: [tags]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
|
||||
---
|
||||
|
||||
|
@ -39,11 +40,14 @@ _**Data type:** String_
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
measurementTagKeys = (bucket, measurement) =>
|
||||
tagKeys(
|
||||
bucket: bucket,
|
||||
predicate: (r) => r._measurement == measurement)
|
||||
predicate: (r) => r._measurement == measurement
|
||||
)
|
||||
```
|
||||
|
||||
_**Used functions:**
|
||||
[tagKeys()](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)_
|
||||
[v1.tagKeys()](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)_
|
||||
|
|
|
@ -10,6 +10,7 @@ menu:
|
|||
weight: 301
|
||||
v2.0/tags: [tags]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
|
||||
---
|
||||
|
||||
|
@ -48,6 +49,8 @@ _**Data type:** String_
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
measurementTagValues = (bucket, measurement, tag) =>
|
||||
tagValues(
|
||||
bucket: bucket,
|
||||
|
@ -57,4 +60,4 @@ measurementTagValues = (bucket, measurement, tag) =>
|
|||
```
|
||||
|
||||
_**Used functions:**
|
||||
[tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_
|
||||
[v1.tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_
|
||||
|
|
|
@ -10,6 +10,7 @@ menu:
|
|||
weight: 301
|
||||
v2.0/tags: [tags]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
|
||||
---
|
||||
|
||||
|
@ -40,7 +41,7 @@ _Defaults to `(r) => true`._
|
|||
_**Data type:** Function_
|
||||
|
||||
### start
|
||||
Specifies the oldest time to be included in the results.
|
||||
The oldest time to include in results.
|
||||
_Defaults to `-30d`._
|
||||
|
||||
Relative start times are defined using negative durations.
|
||||
|
@ -59,6 +60,8 @@ v1.tagKeys(bucket: "my-bucket")
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
tagKeys = (bucket, predicate=(r) => true, start=-30d) =>
|
||||
from(bucket: bucket)
|
||||
|> range(start: start)
|
||||
|
|
|
@ -10,6 +10,7 @@ menu:
|
|||
weight: 301
|
||||
v2.0/tags: [tags]
|
||||
related:
|
||||
- /v2.0/query-data/flux/explore-schema/
|
||||
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
|
||||
---
|
||||
|
||||
|
@ -46,7 +47,7 @@ _Defaults to `(r) => true`._
|
|||
_**Data type:** Function_
|
||||
|
||||
### start
|
||||
Specifies the oldest time to be included in the results.
|
||||
The oldest time to include in results.
|
||||
_Defaults to `-30d`._
|
||||
|
||||
Relative start times are defined using negative durations.
|
||||
|
@ -59,7 +60,7 @@ _**Data type:** Duration_
|
|||
```js
|
||||
import "influxdata/influxdb/v1"
|
||||
|
||||
v1.tagKeys(
|
||||
v1.tagValues(
|
||||
bucket: "my-bucket",
|
||||
tag: "host",
|
||||
)
|
||||
|
@ -67,6 +68,8 @@ v1.tagKeys(
|
|||
|
||||
## Function definition
|
||||
```js
|
||||
package v1
|
||||
|
||||
tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
|
||||
from(bucket: bucket)
|
||||
|> range(start: start)
|
||||
|
|
|
@ -18,7 +18,7 @@ related:
|
|||
---
|
||||
|
||||
SQL Flux functions provide tools for working with data in SQL databases such as
|
||||
MySQL, PostgreSQL, and SQLite.
|
||||
MySQL, PostgreSQL, Snowflake, and SQLite.
|
||||
Import the `sql` package:
|
||||
|
||||
```js
|
||||
|
|
|
@ -37,6 +37,7 @@ The following drivers are available:
|
|||
|
||||
- mysql
|
||||
- postgres
|
||||
- snowflake
|
||||
- sqlite3 – _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#query-an-sqlite-database)._
|
||||
|
||||
### dataSourceName
|
||||
|
@ -53,6 +54,11 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
|
|||
# MySQL Driver DSN
|
||||
username:password@tcp(localhost:3306)/dbname?param=value
|
||||
|
||||
# Snowflake Driver DSNs
|
||||
username[:password]@accountname/dbname/schemaname?param1=value1¶mN=valueN
|
||||
username[:password]@accountname/dbname?param1=value1¶mN=valueN
|
||||
username[:password]@hostname:port/dbname/schemaname?account=<your_account>¶m1=value1¶mN=valueN
|
||||
|
||||
# SQLite Driver DSN
|
||||
file:/path/to/test.db?cache=shared&mode=ro
|
||||
```
|
||||
|
@ -80,7 +86,7 @@ password = secrets.get(key: "MYSQL_PASS")
|
|||
sql.from(
|
||||
driverName: "mysql",
|
||||
dataSourceName: "${username}:${password}@tcp(localhost:3306)/db",
|
||||
query:"SELECT * FROM ExampleTable"
|
||||
query:"SELECT * FROM example_table"
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -95,7 +101,23 @@ password = secrets.get(key: "POSTGRES_PASS")
|
|||
sql.from(
|
||||
driverName: "postgres",
|
||||
dataSourceName: "postgresql://${username}:${password}@localhost",
|
||||
query:"SELECT * FROM ExampleTable"
|
||||
query:"SELECT * FROM example_table"
|
||||
)
|
||||
```
|
||||
|
||||
### Query a Snowflake database
|
||||
```js
|
||||
import "sql"
|
||||
import "influxdata/influxdb/secrets"
|
||||
|
||||
username = secrets.get(key: "SNOWFLAKE_USER")
|
||||
password = secrets.get(key: "SNOWFLAKE_PASS")
|
||||
account = secrets.get(key: "SNOWFLAKE_ACCT")
|
||||
|
||||
sql.from(
|
||||
driverName: "snowflake",
|
||||
dataSourceName: "${username}:${password}@${account}/db/exampleschema?warehouse=wh",
|
||||
query: "SELECT * FROM example_table"
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -114,6 +136,6 @@ import "sql"
|
|||
sql.from(
|
||||
driverName: "sqlite3",
|
||||
dataSourceName: "file:/path/to/test.db?cache=shared&mode=ro",
|
||||
query:"SELECT * FROM ExampleTable"
|
||||
query: "SELECT * FROM example_table"
|
||||
)
|
||||
```
|
||||
|
|
|
@ -20,7 +20,7 @@ import "sql"
|
|||
sql.to(
|
||||
driverName: "mysql",
|
||||
dataSourceName: "username:password@tcp(localhost:3306)/dbname?param=value",
|
||||
table: "ExampleTable",
|
||||
table: "example_table",
|
||||
batchSize: 10000
|
||||
)
|
||||
```
|
||||
|
@ -36,6 +36,7 @@ The following drivers are available:
|
|||
|
||||
- mysql
|
||||
- postgres
|
||||
- snowflake
|
||||
- sqlite3 – _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#write-data-to-an-sqlite-database)._
|
||||
|
||||
### dataSourceName
|
||||
|
@ -52,6 +53,11 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
|
|||
# MySQL Driver DSN
|
||||
username:password@tcp(localhost:3306)/dbname?param=value
|
||||
|
||||
# Snowflake Driver DSNs
|
||||
username[:password]@accountname/dbname/schemaname?param1=value1¶mN=valueN
|
||||
username[:password]@accountname/dbname?param1=value1¶mN=valueN
|
||||
username[:password]@hostname:port/dbname/schemaname?account=<your_account>¶m1=value1¶mN=valueN
|
||||
|
||||
# SQLite Driver DSN
|
||||
file:/path/to/test.db?cache=shared&mode=rw
|
||||
```
|
||||
|
@ -89,7 +95,7 @@ password = secrets.get(key: "MYSQL_PASS")
|
|||
sql.to(
|
||||
driverName: "mysql",
|
||||
dataSourceName: "${username}:${password}@tcp(localhost:3306)/db",
|
||||
table: "ExampleTable"
|
||||
table: "example_table"
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -104,7 +110,23 @@ password = secrets.get(key: "POSTGRES_PASS")
|
|||
sql.to(
|
||||
driverName: "postgres",
|
||||
dataSourceName: "postgresql://${username}:${password}@localhost",
|
||||
table: "ExampleTable"
|
||||
table: "example_table"
|
||||
)
|
||||
```
|
||||
|
||||
### Write data to a Snowflake database
|
||||
```js
|
||||
import "sql"
|
||||
import "influxdata/influxdb/secrets"
|
||||
|
||||
username = secrets.get(key: "SNOWFLAKE_USER")
|
||||
password = secrets.get(key: "SNOWFLAKE_PASS")
|
||||
account = secrets.get(key: "SNOWFLAKE_ACCT")
|
||||
|
||||
sql.to(
|
||||
driverName: "snowflake",
|
||||
dataSourceName: "${username}:${password}@${account}/db/exampleschema?warehouse=wh",
|
||||
table: "example_table"
|
||||
)
|
||||
```
|
||||
|
||||
|
@ -123,6 +145,6 @@ import "sql"
|
|||
sql.to(
|
||||
driverName: "sqlite3",
|
||||
dataSourceName: "file:/path/to/test.db?cache=shared&mode=rw",
|
||||
table: "ExampleTable"
|
||||
table: "example_table"
|
||||
)
|
||||
```
|
||||
|
|
|
@ -19,7 +19,7 @@ _**Output data type:** Boolean_
|
|||
```js
|
||||
import "strings"
|
||||
|
||||
strings.hasPrefix(v: "go gopher", t: "go")
|
||||
strings.hasPrefix(v: "go gopher", prefix: "go")
|
||||
|
||||
// returns true
|
||||
```
|
||||
|
@ -31,7 +31,7 @@ The string value to search.
|
|||
|
||||
_**Data type:** String_
|
||||
|
||||
### t
|
||||
### prefix
|
||||
The prefix to search for.
|
||||
|
||||
_**Data type:** String_
|
||||
|
@ -41,5 +41,5 @@ _**Data type:** String_
|
|||
import "strings"
|
||||
|
||||
data
|
||||
|> filter(fn:(r) => strings.hasPrefix(v: r.metric, t: "int_" ))
|
||||
|> filter(fn:(r) => strings.hasPrefix(v: r.metric, prefix: "int_" ))
|
||||
```
|
||||
|
|
|
@ -19,7 +19,7 @@ _**Output data type:** Boolean_
|
|||
```js
|
||||
import "strings"
|
||||
|
||||
strings.hasSuffix(v: "go gopher", t: "go")
|
||||
strings.hasSuffix(v: "go gopher", suffix: "go")
|
||||
|
||||
// returns false
|
||||
```
|
||||
|
@ -31,7 +31,7 @@ The string value to search.
|
|||
|
||||
_**Data type:** String_
|
||||
|
||||
### t
|
||||
### suffix
|
||||
The suffix to search for.
|
||||
|
||||
_**Data type:** String_
|
||||
|
@ -41,5 +41,5 @@ _**Data type:** String_
|
|||
import "strings"
|
||||
|
||||
data
|
||||
|> filter(fn:(r) => strings.hasSuffix(v: r.metric, t: "_count" ))
|
||||
|> filter(fn:(r) => strings.hasSuffix(v: r.metric, suffix: "_count" ))
|
||||
```
|
||||
|
|
|
@ -90,6 +90,8 @@ Related entries: [implicit block](#implicit-block), [explicit block](#explicit-b
|
|||
|
||||
A data type with two possible values: true or false.
|
||||
By convention, you can express `true` as the integer `1` and false as the integer `0` (zero).
|
||||
In [annotated CSV](/v2.0/reference/syntax/annotated-csv/), columns that contain
|
||||
boolean values are annotated with the `boolean` datatype.
|
||||
|
||||
### bucket
|
||||
|
||||
|
@ -337,8 +339,10 @@ Related entries: [block](#block)
|
|||
|
||||
### float
|
||||
|
||||
A float represents real numbers and is written with a decimal point dividing the integer and fractional parts.
|
||||
For example, 1.0, 3.14.
|
||||
A real number written with a decimal point dividing the integer and fractional parts (`1.0`, `3.14`, `-20.1`).
|
||||
InfluxDB supports 64-bit float values.
|
||||
In [annotated CSV](/v2.0/reference/syntax/annotated-csv/), columns that contain
|
||||
float values are annotated with the `double` datatype.
|
||||
|
||||
### flush interval
|
||||
|
||||
|
@ -466,9 +470,14 @@ Related entries: [aggregator plugin](#aggregator-plugin), [collection interval](
|
|||
An entity comprising data on a server (or virtual server in cloud computing).
|
||||
<!-- An instance in an InfluxDB Enterprise cluster may scale across multiple servers or nodes in a network. -->
|
||||
|
||||
### int (data type)
|
||||
### integer
|
||||
|
||||
A data type that represents an integer, a whole number that's positive, negative, or zero.
|
||||
A whole number that is positive, negative, or zero (`0`, `-5`, `143`).
|
||||
InfluxDB supports 64-bit integers (minimum: `-9223372036854775808`, maximum: `9223372036854775807`).
|
||||
In [annotated CSV](/v2.0/reference/syntax/annotated-csv/), columns that contain
|
||||
integers are annotated with the `long` datatype.
|
||||
|
||||
Related entries: [unsigned integer](#unsigned-integer)
|
||||
|
||||
## J
|
||||
|
||||
|
@ -945,6 +954,8 @@ A stream includes a series of tables over a sequence of time intervals.
|
|||
### string
|
||||
|
||||
A data type used to represent text.
|
||||
In [annotated CSV](/v2.0/reference/syntax/annotated-csv/), columns that contain
|
||||
string values are annotated with the `string` datatype.
|
||||
|
||||
## T
|
||||
|
||||
|
@ -1094,6 +1105,14 @@ InfluxDB supports the following unix timestamp precisions:
|
|||
|
||||
Related entries: [timestamp](#timestamp), [RFC3339 timestamp](#rfc3339-timestamp)
|
||||
|
||||
### unsigned integer
|
||||
A whole number that is positive or zero (`0`, `143`). Also known as a "uinteger."
|
||||
InfluxDB supports 64-bit unsigned integers (minimum: `0`, maximum: `18446744073709551615`).
|
||||
In [annotated CSV](/v2.0/reference/syntax/annotated-csv/), columns that contain
|
||||
integers are annotated with the `unisgnedLong` datatype.
|
||||
|
||||
Related entries: [integer](#integer)
|
||||
|
||||
### user
|
||||
|
||||
InfluxDB users are granted permission to access to InfluxDB.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue