Merge pull request #1534 from influxdata/export-resources
Add how export resources by namepull/1539/head
commit
ac49b569da
|
@ -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 <org-name> -f <file-path> -t <token>
|
||||
|
@ -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 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**
|
||||
|
@ -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 <org-name> -f <file-path> -t <token> [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.**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,26 +31,34 @@ influx export [command]
|
|||
|
||||
## Flags
|
||||
|
||||
| Flag | | Description | Input Type | {{< cli/mapped >}} |
|
||||
|:---- |:--- |:----------- |:---------- |:------------------ |
|
||||
| `-c` | `--active-config` | CLI configuration to use for command | string | |
|
||||
| | `--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:8086`) | 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
|
||||
|
@ -61,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
|
||||
```
|
||||
|
|
|
@ -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 |
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue