From 6b3022254c5d6ebd5e6ea3946dabae0c06865767 Mon Sep 17 00:00:00 2001 From: pierwill <19642016+pierwill@users.noreply.github.com> Date: Tue, 22 Sep 2020 12:35:51 -0700 Subject: [PATCH 1/5] Document `influx version` command (#1528) * Document `influx version` command --- .../v2.0/reference/cli/influx/_index.md | 1 + .../v2.0/reference/cli/influx/version.md | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 content/influxdb/v2.0/reference/cli/influx/version.md diff --git a/content/influxdb/v2.0/reference/cli/influx/_index.md b/content/influxdb/v2.0/reference/cli/influx/_index.md index ba32594e0..e2197809c 100644 --- a/content/influxdb/v2.0/reference/cli/influx/_index.md +++ b/content/influxdb/v2.0/reference/cli/influx/_index.md @@ -67,6 +67,7 @@ influx [command] | [template](/influxdb/v2.0/reference/cli/influx/template) | Summarize and validate an InfluxDB template | | [transpile](/influxdb/v2.0/reference/cli/influx/transpile) | Manually transpile an InfluxQL query to Flux | | [user](/influxdb/v2.0/reference/cli/influx/user) | User management commands | +| [version](/influxdb/v2.0/reference/cli/influx/version) | Print the influx CLI version | | [write](/influxdb/v2.0/reference/cli/influx/write) | Write points to InfluxDB | ## Mapped environment variables diff --git a/content/influxdb/v2.0/reference/cli/influx/version.md b/content/influxdb/v2.0/reference/cli/influx/version.md new file mode 100644 index 000000000..05dca0f76 --- /dev/null +++ b/content/influxdb/v2.0/reference/cli/influx/version.md @@ -0,0 +1,23 @@ +--- +title: influx version +description: The `influx version` command outputs the current version of the influx command line interface (CLI). +influxdb/v2.0/tags: [influx, cli] +menu: + influxdb_2_0_ref: + parent: influx +weight: 202 +--- + +The `influx version` command outputs the current version of the influx command line interface (CLI). + +## Usage + +``` +influx version [flags] +``` + +## Flags + +| Flag | | Description | +|:---- |:--- |:----------- | +| `-h` | `--help` | Help for the `version` command | From 2aa4af137a21836e173f5cc0a698400c572a92db Mon Sep 17 00:00:00 2001 From: pierwill Date: Tue, 22 Sep 2020 12:42:26 -0700 Subject: [PATCH 2/5] Edit case for "influx CLI" --- content/influxdb/v2.0/write-data/developer-tools/api.md | 2 +- content/influxdb/v2.0/write-data/developer-tools/influx-cli.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/influxdb/v2.0/write-data/developer-tools/api.md b/content/influxdb/v2.0/write-data/developer-tools/api.md index 5c0c2f5f7..ebd0300f7 100644 --- a/content/influxdb/v2.0/write-data/developer-tools/api.md +++ b/content/influxdb/v2.0/write-data/developer-tools/api.md @@ -1,5 +1,5 @@ --- -title: InfluxDB API +title: Use InfluxDB API seotitle: Write data with the InfluxDB API list_title: Write data with the InfluxDB API weight: 206 diff --git a/content/influxdb/v2.0/write-data/developer-tools/influx-cli.md b/content/influxdb/v2.0/write-data/developer-tools/influx-cli.md index f42d7b2a8..bec4520d7 100644 --- a/content/influxdb/v2.0/write-data/developer-tools/influx-cli.md +++ b/content/influxdb/v2.0/write-data/developer-tools/influx-cli.md @@ -1,5 +1,5 @@ --- -title: Influx CLI +title: Use influx CLI seotitle: Write data with the influx CLI list_title: Write data with the influx CLI weight: 205 From 9046aad9c5c5a90bbb5b97add9e26bd9e188b447 Mon Sep 17 00:00:00 2001 From: Mark Nguyen Date: Wed, 23 Sep 2020 00:00:11 -0700 Subject: [PATCH 3/5] Fixed minor typo in python library getting started documentation If you follow the code example line by line, you end up using InfluxDBClient which has not been imported yet. The complete example clearly show us referencing it through the module, so I edited the step-by-step instructions to do the same. --- content/influxdb/v2.0/tools/client-libraries/python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/influxdb/v2.0/tools/client-libraries/python.md b/content/influxdb/v2.0/tools/client-libraries/python.md index 5d5da089d..e58fd286b 100644 --- a/content/influxdb/v2.0/tools/client-libraries/python.md +++ b/content/influxdb/v2.0/tools/client-libraries/python.md @@ -56,7 +56,7 @@ We are going to write some data in [line protocol](/influxdb/v2.0/reference/synt 3. Instantiate the client. The `InfluxDBClient` object takes three named parameters: `url`, `org`, and `token`. Pass in the named parameters. ```python - client = InfluxDBClient( + client = influxdb_client.InfluxDBClient( url=url, token=token, org=org From 31c3737cb59f31dee798ea8f0f2ac36a2b3e243d Mon Sep 17 00:00:00 2001 From: Kelly Date: Wed, 23 Sep 2020 08:00:24 -0700 Subject: [PATCH 4/5] add how export resources by name --- .../v2.0/influxdb-templates/create.md | 32 +++++++++-- .../reference/cli/influx/export/_index.md | 57 ++++++++++++------- 2 files changed, 63 insertions(+), 26 deletions(-) diff --git a/content/influxdb/v2.0/influxdb-templates/create.md b/content/influxdb/v2.0/influxdb-templates/create.md index 5f431deea..4a1428f39 100644 --- a/content/influxdb/v2.0/influxdb-templates/create.md +++ b/content/influxdb/v2.0/influxdb-templates/create.md @@ -51,6 +51,7 @@ In **InfluxDB Cloud**, your user account is an organization. 4. Export the template _(see [below](#export-a-template))_. ## Export a template + Do one of the following to export a template: - [Export all resources in an organization](#export-all-resources) @@ -58,6 +59,7 @@ Do one of the following to export a template: - [Export a stack and its associated resources](#export-a-stack) ### Export all resources + To export all templatable resources within an organization to a template manifest, use the `influx export all` command. Provide the following: @@ -69,6 +71,7 @@ Provide the following: **JSON** (`.json`) are supported. ###### Export all resources to a template + ```sh # Syntax influx export all -o -f -t @@ -81,11 +84,13 @@ influx export all \ ``` #### Export resources filtered by labelName or resourceKind + 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` +Provide multiple filters for both `labelName` and `resourceKind`. ###### Export only dashboards and buckets with specific labels + The following example exports resources that match this predicate logic: ```js @@ -109,8 +114,8 @@ For information about flags, see the [`influx export all` documentation](/influxdb/v2.0/reference/cli/influx/export/all/). ### Export specific resources -To export specific resources within an organization to a template manifest, -use the `influx export` with resource flags for each resource to include. + +To export specific resources to a template manifest, use the `influx export` with resource flags for each resource to include. Provide the following: - **Organization name** or **ID** @@ -118,16 +123,17 @@ Provide the following: - **Destination path and filename** for the template manifest. The filename extension determines the template format—both **YAML** (`.yml`) and **JSON** (`.json`) are supported. -- **Resource flags** with corresponding lists of resource IDs to include in the template. +- **Resource flags** with corresponding lists of resource IDs or resource names to include in the template. For information about what resource flags are available, see the [`influx export` documentation](/influxdb/v2.0/reference/cli/influx/export/). ###### Export specific resources to a template + ```sh # Syntax influx export all -o -f -t [resource-flags] -# Example +# Export specific resources by ID influx export all \ -o my-org \ -f ~/templates/awesome-template.yml \ @@ -135,9 +141,19 @@ influx export all \ --buckets=00x000ooo0xx0xx,o0xx0xx00x000oo \ --dashboards=00000xX0x0X00x000 \ --telegraf-configs=00000x0x000X0x0X0 + +# Export specific resources by name +influx export all \ + -o my-org \ + -f ~/templates/awesome-template.yml \ + -t $INFLUX_TOKEN \ + --bucket-names=bucket1,bucket2 \ + --dashboard-names=dashboard1,dashboard2 \ + --telegraf-config-names=telegrafconfig1,telegrafconfig2 ``` ### Export a stack + To export a stack and all its associated resources as a template, use the `influx export stack` command. Provide the following: @@ -150,6 +166,7 @@ Provide the following: - **Stack ID** ###### Export a stack as a template + ```sh # Syntax influx export stack \ @@ -167,6 +184,7 @@ influx export stack \ ``` ## Include user-definable resource names + After exporting a template manifest, replace resource names with **environment references** to let users customize resource names when installing your template. @@ -178,7 +196,7 @@ to let users customize resource names when installing your template. - `endpointName` _(unique to `NotificationRule` resources)_ 3. Replace the resource field value with an `envRef` object with a `key` property - that reference the key of a key-value pair the user provides when installing the template. + that references the key of a key-value pair the user provides when installing the template. During installation, the `envRef` object is replaced by the value of the referenced key-value pair. If the user does not provide the environment reference key-value pair, InfluxDB @@ -233,6 +251,7 @@ exist in the template and what keys to use to replace them._ {{% note %}} #### Resource fields that support environment references + Only the following fields support environment references: - `metadata.name` @@ -241,6 +260,7 @@ Only the following fields support environment references: {{% /note %}} ## Share your InfluxDB templates + Share your InfluxDB templates with the entire InfluxData community. **Contribute your template to the [InfluxDB Community Templates](https://github.com/influxdata/community-templates/) repository on GitHub.** diff --git a/content/influxdb/v2.0/reference/cli/influx/export/_index.md b/content/influxdb/v2.0/reference/cli/influx/export/_index.md index dfe6bd881..2d59901d2 100644 --- a/content/influxdb/v2.0/reference/cli/influx/export/_index.md +++ b/content/influxdb/v2.0/reference/cli/influx/export/_index.md @@ -16,12 +16,14 @@ _For detailed examples of exporting InfluxDB templates, see [Create an InfluxDB template](/influxdb/v2.0/influxdb-templates/create/)._ ## Usage + ``` influx export [flags] influx export [command] ``` ## Available subcommands + | Subcommand | Description | |:---------- |:----------- | | [all](/influxdb/v2.0/reference/cli/influx/export/all/) | Export all resources in an organization as a template | @@ -29,25 +31,34 @@ influx export [command] ## Flags -| Flag | | Description | Input Type | {{< cli/mapped >}} | -|:---- |:--- |:----------- |:---------- |:------------------ | -| | `--buckets` | Comma-separated list of bucket IDs | string | | -| | `--checks` | Comma-separated list of check IDs | string | | -| | `--configs-path` | Path to `influx` CLI configurations (default `~/.influxdbv2/configs`) | string |`INFLUX_CONFIGS_PATH` | -| | `--dashboards` | Comma-separated list of dashboard IDs | string | | -| | `--endpoints` | Comma-separated list of notification endpoint IDs | string | | -| `-f` | `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | | -| `-h` | `--help` | Help for the `export` command | | | -| | `--host` | HTTP address of InfluxDB (default `http://localhost:9999`) | string | `INFLUX_HOST` | -| | `--labels` | Comma-separated list of label IDs | string | | -| | `--resource-type` | Resource type associated with all IDs via stdin | string | | -| | `--rules` | Comma-separated list of notification rule IDs | string | | -| | `--skip-verify` | Skip TLS certificate verification | | | -| | `--stack-id` | Stack ID to include resources from in export | string | | -| | `--tasks` | Comma-separated list of task IDs | string | | -| | `--telegraf-configs` | Comma-separated list of Telegraf configuration IDs | string | | -| `-t` | `--token` | Authentication token | string | `INFLUX_TOKEN` | -| | `--variables` | Comma-separated list of variable IDs | string | | +| Flag | | Description | Input Type | {{< cli/mapped >}} | +|:---- |:--- |:----------- |:---------- |:------------------ | +| | `--buckets` | Comma-separated list of bucket IDs | string | | +| | `--bucket-names` | Comma-separated list of bucket names | string | | +| | `--checks` | Comma-separated list of check IDs | string | | +| | `--check-names` | Comma-separated list of check names | string | | +| | `--configs-path` | Path to `influx` CLI configurations (default `~/.influxdbv2/configs`) | string |`INFLUX_CONFIGS_PATH` | +| | `--dashboards` | Comma-separated list of dashboard IDs | string | | +| | `--dashboard-names` | Comma-separated list of dashboard names | string | | +| | `--endpoints` | Comma-separated list of notification endpoint IDs | string | | +| | `--endpoint-names` | Comma-separated list of notification endpoint names | string | | +| `-f` | `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | | +| `-h` | `--help` | Help for the `export` command | | | +| | `--host` | HTTP address of InfluxDB (default `http://localhost:9999`) | string | `INFLUX_HOST` | +| | `--labels` | Comma-separated list of label IDs | string | | +| | `--label-names` | Comma-separated list of label names | string | | +| | `--resource-type` | Resource type associated with all IDs via stdin | string | | +| | `--rules` | Comma-separated list of notification rule IDs | string | | +| | `--rule-names` | Comma-separated list of notification rule names | string | | +| | `--skip-verify` | Skip TLS certificate verification | | | +| | `--stack-id` | Stack ID to include resources from in export | string | | +| | `--tasks` | Comma-separated list of task IDs | string | | +| | `--task-names` | Comma-separated list of task names | string | | +| | `--telegraf-configs` | Comma-separated list of Telegraf configuration IDs | string | | +| | `--telegraf-config-names` | Comma-separated list of Telegraf configuration names | string | | +| `-t` | `--token` | Authentication token | string | `INFLUX_TOKEN` | +| | `--variables` | Comma-separated list of variable IDs | string | | +| | `--variable-names` | Comma-separated list of variable names | string | | ## Examples ```sh @@ -60,10 +71,16 @@ influx export \ --labels=$LID1,$LID2,$LID3 \ --dashboards=$DID1,$DID2,$DID3 +# Export buckets, labels, and dashboards by name +influx export \ + --buckets=bucket1,bucket2,bucket3 \ + --labels=label1,label2,label3 \ + --dashboards=dashboard1,dashboard2,dashboard3 + # Export all resources associated with a stack influx export --stack-id $STACK_ID # Export resources associated with a stack and resources # *not* associated with the stack -influx export --stack-id $STACK_ID --buckets $BUCKET_ID +influx export --stack-id $STACK_ID --buckets $BUCKET_ID --dashboard-names bucket1 ``` From 08064362edabce42b16dbabd1accd3b40d4a1027 Mon Sep 17 00:00:00 2001 From: kelseiv <47797004+kelseiv@users.noreply.github.com> Date: Wed, 23 Sep 2020 08:04:12 -0700 Subject: [PATCH 5/5] Update create.md --- content/influxdb/v2.0/influxdb-templates/create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/influxdb/v2.0/influxdb-templates/create.md b/content/influxdb/v2.0/influxdb-templates/create.md index 4a1428f39..236c8487c 100644 --- a/content/influxdb/v2.0/influxdb-templates/create.md +++ b/content/influxdb/v2.0/influxdb-templates/create.md @@ -115,7 +115,7 @@ For information about flags, see the ### Export specific resources -To export specific resources to a template manifest, use the `influx export` with resource flags for each resource to include. +To export specific resources within an organization to a template manifest, use the `influx export` with resource flags for each resource to include. Provide the following: - **Organization name** or **ID**