docs(WIP): restructuring section seperation
parent
2cae2ddbab
commit
a812f964e0
|
@ -59,7 +59,7 @@ When you select **Flux** as the query language, configure the following:
|
||||||
- **Default Bucket**: The default [bucket](/influxdb/v2/admin/buckets/) to use in Flux queries
|
- **Default Bucket**: The default [bucket](/influxdb/v2/admin/buckets/) to use in Flux queries
|
||||||
- **Token**: Your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
- **Token**: Your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
||||||
|
|
||||||
{{< img-hd src="/img/influxdb/v2-grafana-flux.png" alt="Flux configuration for InfluxDB OSS 2.x" />}}
|
{{< img-hd src="/img/influxdb3/OSS-v2-grafana-product-dropdown-flux.png" alt="Flux configuration for InfluxDB OSS 2.x" />}}
|
||||||
|
|
||||||
Click **Save & Test**. Grafana attempts to connect to InfluxDB OSS 2.x and returns the results of the test.
|
Click **Save & Test**. Grafana attempts to connect to InfluxDB OSS 2.x and returns the results of the test.
|
||||||
|
|
||||||
|
@ -70,275 +70,96 @@ Click **Save & Test**. Grafana attempts to connect to InfluxDB OSS 2.x and retur
|
||||||
|
|
||||||
## Configure Grafana to use InfluxQL
|
## Configure Grafana to use InfluxQL
|
||||||
|
|
||||||
To query InfluxDB {{< current-version >}} with InfluxQL, find your use case below,
|
> [!Important]
|
||||||
and then complete the instructions to configure Grafana:
|
> #### DBRP mapping required
|
||||||
|
>
|
||||||
|
> To query InfluxDB OSS 2.x with InfluxQL, you must first create Database and Retention Policy (DBRP) mappings.
|
||||||
|
> The configuration form displays a warning if DBRP mapping is required.
|
||||||
|
|
||||||
- [Installed a new InfluxDB {{< current-version >}} instance](#installed-a-new-influxdb-instance)
|
When you select **InfluxQL** as the query language, you can authenticate using either tokens or username/password credentials.
|
||||||
- [Upgraded from InfluxDB 1.x to {{< current-version >}} (following the official upgrade)](#upgraded-from-influxdb-1x-to-2x)
|
|
||||||
- [Manually migrated from InfluxDB 1.x to {{< current-version >}}](#manually-migrated-from-influxdb-1x-to-2x)
|
|
||||||
|
|
||||||
### Installed a new InfluxDB instance
|
### Token authentication (recommended)
|
||||||
|
|
||||||
To configure Grafana to use InfluxQL with a new install of InfluxDB {{< current-version >}}, do the following:
|
Configure the following fields:
|
||||||
|
|
||||||
1. [Authenticate with InfluxDB {{< current-version >}} tokens](/influxdb/version/admin/tokens/).
|
- **Database**: The database name [mapped to your InfluxDB bucket](#create-dbrp-mappings)
|
||||||
2. [Manually create DBRP mappings](#view-and-create-influxdb-dbrp-mappings).
|
- **User**: Enter any string (this field is required by the form)
|
||||||
|
- **Password**: Your InfluxDB [API token](/influxdb/v2/admin/tokens/)
|
||||||
|
|
||||||
### Upgraded from InfluxDB 1.x to 2.x
|
### Username and password authentication
|
||||||
|
|
||||||
To configure Grafana to use InfluxQL when you've upgraded from InfluxDB 1.x to
|
Configure the following fields:
|
||||||
InfluxDB {{< current-version >}} (following an [official upgrade guide](/influxdb/version/upgrade/v1-to-v2/)):
|
|
||||||
|
|
||||||
1. Authenticate using the _non-admin_ [v1 compatible authentication credentials](#view-and-create-influxdb-v1-authorizations)
|
- **Database**: The database name [mapped to your InfluxDB bucket](#create-dbrp-mappings)
|
||||||
created during the upgrade process.
|
- **User**: Your [v1 authorization username](#create-v1-authorizations)
|
||||||
2. Use the DBRP mappings InfluxDB automatically created in the upgrade process (no action necessary).
|
- **Password**: Your [v1 authorization password](#create-v1-authorizations)
|
||||||
|
|
||||||
### Manually migrated from InfluxDB 1.x to 2.x
|
{{< img-hd src="/img/influxdb/v2-grafana-influxql.png" alt="InfluxQL configuration for InfluxDB OSS 2.x with DBRP warning" />}}
|
||||||
|
|
||||||
To configure Grafana to use InfluxQL when you've manually migrated from InfluxDB
|
Click **Save & Test**. Grafana attempts to connect to InfluxDB OSS 2.x and returns the results of the test.
|
||||||
1.x to InfluxDB {{< current-version >}}, do the following:
|
|
||||||
|
|
||||||
1. If your InfluxDB 1.x instance required authentication,
|
### Create DBRP mappings
|
||||||
[create v1 compatible authentication credentials](#view-and-create-influxdb-v1-authorizations)
|
|
||||||
to match your previous 1.x username and password.
|
|
||||||
Otherwise, use [InfluxDB v2 token authentication](/influxdb/version/admin/tokens/).
|
|
||||||
2. [Manually create DBRP mappings](#view-and-create-influxdb-dbrp-mappings).
|
|
||||||
|
|
||||||
{{< expand-wrapper >}}
|
When using InfluxQL to query InfluxDB, the query must specify a database and retention policy.
|
||||||
{{% expand "View and create InfluxDB v1 authorizations" %}}
|
InfluxDB DBRP mappings associate database and retention policy combinations with InfluxDB OSS 2.x buckets.
|
||||||
|
|
||||||
InfluxDB {{< current-version >}} provides a 1.x compatible authentication API that lets you
|
#### View existing DBRP mappings
|
||||||
authenticate with a username and password like InfluxDB 1.x
|
|
||||||
_(separate from the credentials used to log into the InfluxDB user interface)_.
|
|
||||||
|
|
||||||
#### View existing v1 authorizations
|
Use the [`influx v1 dbrp list`](/influxdb/v2/reference/cli/influx/v1/dbrp/list/) command:
|
||||||
|
|
||||||
Use the [`influx v1 auth list`](/influxdb/version/reference/cli/influx/v1/auth/list/)
|
|
||||||
to list existing InfluxDB v1 compatible authorizations.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
influx v1 auth list
|
influx v1 dbrp list
|
||||||
|
Create a DBRP mapping
|
||||||
|
Use the influx v1 dbrp create command:
|
||||||
|
shinflux v1 dbrp create \
|
||||||
|
--db example-db \
|
||||||
|
--rp example-rp \
|
||||||
|
--bucket-id 00xX00o0X001 \
|
||||||
|
--default
|
||||||
|
```
|
||||||
|
|
||||||
|
Provide:
|
||||||
|
|
||||||
|
- `--db:` Database name
|
||||||
|
- `--rp:` Retention policy name (not retention period)
|
||||||
|
- `--bucket-id:` Bucket ID
|
||||||
|
- `--default:` (Optional) Make this the default retention policy for the database
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
Repeat for each DBRP combination
|
||||||
|
Each unique database and retention policy combination used by Grafana must be mapped to an InfluxDB OSS 2.x bucket.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
|
For more information, see Database and retention policy mapping.
|
||||||
|
|
||||||
|
**Create v1 authorizations**
|
||||||
|
InfluxDB OSS 2.x provides a v1-compatible authentication API for username/password authentication.
|
||||||
|
|
||||||
|
**View existing v1 authorizations**
|
||||||
|
Use the `influx v1 auth list` command:
|
||||||
|
```sh
|
||||||
|
shinflux v1 auth list
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Create a v1 authorization
|
**Create a v1 authorization**
|
||||||
|
Use the `influx v1 auth create` command:
|
||||||
Use the [`influx v1 auth create` command](/influxdb/version/reference/cli/influx/v1/auth/create/)
|
|
||||||
to grant read/write permissions to specific buckets. Provide the following:
|
|
||||||
|
|
||||||
- [bucket IDs](/influxdb/version/admin/buckets/view-buckets/) to grant read
|
|
||||||
or write permissions to
|
|
||||||
- new username
|
|
||||||
- new password _(when prompted)_
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
```sh
|
```sh
|
||||||
influx v1 auth create \
|
shinflux v1 auth create \
|
||||||
--read-bucket 00xX00o0X001 \
|
--read-bucket 00xX00o0X001 \
|
||||||
--write-bucket 00xX00o0X001 \
|
--write-bucket 00xX00o0X001 \
|
||||||
--username example-user
|
--username example-user
|
||||||
```
|
```
|
||||||
{{% /expand %}}
|
|
||||||
{{< expand "View and create InfluxDB DBRP mappings" >}}
|
|
||||||
|
|
||||||
When using InfluxQL to query InfluxDB, the query must specify a database and a retention policy.
|
Provide:
|
||||||
InfluxDB DBRP mappings associate database and retention policy combinations with
|
|
||||||
InfluxDB {{< current-version >}} [buckets](/influxdb/version/reference/glossary/#bucket).
|
|
||||||
|
|
||||||
DBRP mappings do not affect the retention period of the target bucket.
|
- `--read-bucket`: Bucket ID to grant read permissions
|
||||||
These mappings allow queries following InfluxDB 1.x conventions to successfully
|
- `--write-bucket`: Bucket ID to grant write permissions
|
||||||
query InfluxDB {{< current-version >}} buckets.
|
- `--username`: New username
|
||||||
|
|
||||||
#### View existing DBRP mappings
|
You'll be prompted to enter a password.
|
||||||
|
<!-------------------------------- END INFLUXQL ------------------------------->
|
||||||
Use the [`influx v1 dbrp list`](/influxdb/version/reference/cli/influx/v1/dbrp/list/)
|
|
||||||
to list existing DBRP mappings.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
influx v1 dbrp list
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Create a DBRP mapping
|
|
||||||
|
|
||||||
Use the [`influx v1 dbrp create` command](/influxdb/version/reference/cli/influx/v1/dbrp/create/)
|
|
||||||
command to create a DBRP mapping.
|
|
||||||
Provide the following:
|
|
||||||
|
|
||||||
- database name
|
|
||||||
- retention policy name _(not retention period)_
|
|
||||||
- [bucket ID](/influxdb/version/admin/buckets/view-buckets/)
|
|
||||||
- _(optional)_ `--default` flag if you want the retention policy to be the default retention
|
|
||||||
policy for the specified database
|
|
||||||
|
|
||||||
```sh
|
|
||||||
influx v1 dbrp create \
|
|
||||||
--db example-db \
|
|
||||||
--rp example-rp \
|
|
||||||
--bucket-id 00xX00o0X001 \
|
|
||||||
--default
|
|
||||||
```
|
|
||||||
|
|
||||||
{{% note %}}
|
|
||||||
#### Repeat for each DBRP combination
|
|
||||||
|
|
||||||
Each unique database and retention policy combination used by Grafana must be
|
|
||||||
mapped to an InfluxDB {{< current-version >}} bucket.
|
|
||||||
If you have multiple retention policies for a single bucket, set one of the the
|
|
||||||
retention polices as the default using the `--default` flag.
|
|
||||||
{{% /note %}}
|
|
||||||
|
|
||||||
_For more information about DBRP mapping, see
|
|
||||||
[Database and retention policy mapping](/influxdb/version/reference/api/influxdb-1x/dbrp/)._
|
|
||||||
|
|
||||||
{{< /expand >}}
|
|
||||||
{{< /expand-wrapper >}}
|
|
||||||
|
|
||||||
{{% /show-in %}}
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
<!-------------------------- END OSS InfluxQL setup -------------------------->
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
<!------------------------ BEGIN Cloud InfluxQL setup ------------------------>
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
{{% show-in "cloud,cloud-serverless" %}}
|
|
||||||
|
|
||||||
To query InfluxDB Cloud from Grafana using InfluxQL:
|
|
||||||
|
|
||||||
1. [Download and set up the `influx` CLI](#download-and-set-up-the-influx-cli)
|
|
||||||
2. [Create an InfluxDB DBRP mapping](#create-an-influxdb-dbrp-mapping)
|
|
||||||
3. [Configure your InfluxDB connection](#configure-your-influxdb-connection)
|
|
||||||
|
|
||||||
### Download and set up the influx CLI
|
|
||||||
|
|
||||||
1. [Download the latest version of the `influx` CLI](/influxdb/cloud/sign-up/#optional-download-install-and-use-the-influx-cli)
|
|
||||||
appropriate for your local operating system.
|
|
||||||
2. Create a CLI configuration that provides the required InfluxDB Cloud **host**,
|
|
||||||
**organization**, and **API token** to all CLI commands.
|
|
||||||
Use the [`influx config create` command](/influxdb/cloud/reference/cli/influx/config/create/)
|
|
||||||
and provide the following:
|
|
||||||
|
|
||||||
- [InfluxDB Cloud URL](/influxdb/cloud/reference/regions/)
|
|
||||||
- [organization name](/influxdb/cloud/admin/organizations/) _(by default, your email address)_
|
|
||||||
- [API token](/influxdb/cloud/admin/tokens/)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
influx config create \
|
|
||||||
--config-name example-config-name \
|
|
||||||
--host-url https://{{< influxdb/host >}} \
|
|
||||||
--org example-org \
|
|
||||||
--token My5uP3rSeCr37t0k3n
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information about `influx` CLI configurations,
|
|
||||||
see [`influx config`](/influxdb/cloud/reference/cli/influx/config/).
|
|
||||||
|
|
||||||
### Create an InfluxDB DBRP mapping
|
|
||||||
|
|
||||||
When using InfluxQL to query InfluxDB Cloud, the query must specify a database and a retention policy.
|
|
||||||
Use the [`influx v1 dbrp create` command](/influxdb/cloud/reference/cli/influx/v1/dbrp/create/)
|
|
||||||
command to create a database/retention policy (DBRP) mapping that associates a database
|
|
||||||
and retention policy combination with an InfluxDB Cloud [bucket](/influxdb/cloud/reference/glossary/#bucket).
|
|
||||||
|
|
||||||
DBRP mappings do not affect the retention period of the target bucket.
|
|
||||||
These mappings allow queries following InfluxDB 1.x conventions to successfully
|
|
||||||
query InfluxDB Cloud buckets.
|
|
||||||
|
|
||||||
{{% note %}}
|
|
||||||
##### Automatically create DBRP mappings on write
|
|
||||||
|
|
||||||
When using the InfluxDB 1.x compatibility API to write data to InfluxDB Cloud,
|
|
||||||
InfluxDB Cloud automatically creates DBRP mappings for buckets whose names match the
|
|
||||||
`db/rp` naming pattern of the database and retention policy specified in the write request.
|
|
||||||
For more information, see [Database and retention policy mapping – Writing data](/influxdb/cloud/reference/api/influxdb-1x/dbrp/#when-writing-data).
|
|
||||||
{{% /note %}}
|
|
||||||
|
|
||||||
Provide the following:
|
|
||||||
|
|
||||||
- database name
|
|
||||||
- [retention policy](/influxdb/v1/concepts/glossary/#retention-policy-rp) name _(not retention period)_
|
|
||||||
- [bucket ID](/influxdb/cloud/admin/buckets/view-buckets/)
|
|
||||||
- _(optional)_ `--default` flag if you want the retention policy to be the default retention
|
|
||||||
policy for the specified database
|
|
||||||
|
|
||||||
```sh
|
|
||||||
influx v1 dbrp create \
|
|
||||||
--db example-db \
|
|
||||||
--rp example-rp \
|
|
||||||
--bucket-id 00xX00o0X001 \
|
|
||||||
--default
|
|
||||||
```
|
|
||||||
|
|
||||||
{{% note %}}
|
|
||||||
#### Repeat for each DBRP combination
|
|
||||||
|
|
||||||
Each unique database and retention policy combination used by Grafana must be
|
|
||||||
mapped to an InfluxDB {{< current-version >}} bucket.
|
|
||||||
If you have multiple retention policies for a single bucket, set one of the the
|
|
||||||
retention polices as the default using the `--default` flag.
|
|
||||||
{{% /note %}}
|
|
||||||
|
|
||||||
_For more information about DBRP mapping, see
|
|
||||||
[Database and retention policy mapping](/influxdb/cloud/reference/api/influxdb-1x/dbrp/)._
|
|
||||||
|
|
||||||
{{% /show-in %}}
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
<!------------------------- END Cloud InfluxQL setup ------------------------->
|
|
||||||
<!---------------------------------------------------------------------------->
|
|
||||||
|
|
||||||
|
|
||||||
### Configure your InfluxDB connection
|
|
||||||
|
|
||||||
With **InfluxQL** selected as the query language in your InfluxDB data source settings:
|
|
||||||
|
|
||||||
1. Under **HTTP**, enter the following:
|
|
||||||
|
|
||||||
- **URL**: Your [InfluxDB URL](/influxdb/version/reference/urls/).
|
|
||||||
|
|
||||||
```sh
|
|
||||||
http://localhost:8086/
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Configure InfluxDB authentication:
|
|
||||||
|
|
||||||
- ##### Token authentication
|
|
||||||
|
|
||||||
- Under **Custom HTTP Headers**, select **{{< icon "plus" >}}Add Header**. Provide your InfluxDB API token:
|
|
||||||
|
|
||||||
- **Header**: Enter `Authorization`
|
|
||||||
- **Value**: Use the `Token` schema and provide your [InfluxDB API token](/influxdb/version/admin/tokens/).
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```
|
|
||||||
Token y0uR5uP3rSecr3tT0k3n
|
|
||||||
```
|
|
||||||
|
|
||||||
- Under **InfluxDB Details**, do the following:
|
|
||||||
|
|
||||||
- **Database**: Enter the database name [mapped to your InfluxDB {{< current-version >}} bucket](#view-and-create-influxdb-dbrp-mappings)
|
|
||||||
- **HTTP Method**: Select **GET**
|
|
||||||
|
|
||||||
- ##### Authenticate with username and password
|
|
||||||
|
|
||||||
Under **InfluxDB Details**, do the following:
|
|
||||||
|
|
||||||
- **Database**: Enter the database name [mapped to your InfluxDB {{< current-version >}} bucket](#view-and-create-influxdb-dbrp-mappings)
|
|
||||||
- **User**: Enter the username associated with your [InfluxDB 1.x compatibility authorization](#view-and-create-influxdb-v1-authorizations)
|
|
||||||
- **Password**: Enter the password associated with your [InfluxDB 1.x compatibility authorization](#view-and-create-influxdb-dbrp-mappings)
|
|
||||||
- **HTTP Method**: Select **GET**
|
|
||||||
|
|
||||||
3. Click **Save & Test**. Grafana attempts to connect to the InfluxDB {{< current-version >}} data source
|
|
||||||
and returns the results of the test.
|
|
||||||
|
|
||||||
{{% show-in "cloud,cloud-serverless" %}}
|
|
||||||
{{< img-hd src="/img/influxdb/cloud-tools-grafana-influxql.png" alt="Use Grafana with InfluxDB Cloud and Flux" />}}
|
|
||||||
{{% /show-in %}}
|
|
||||||
|
|
||||||
{{< show-in "v2" >}}
|
|
||||||
{{< img-hd src="/img/influxdb/version-tools-grafana-influxql.png" alt="Use Grafana with InfluxDB and Flux" />}}
|
|
||||||
{{< /show-in >}}
|
|
||||||
|
|
||||||
{{% /tab-content %}}
|
{{% /tab-content %}}
|
||||||
<!--------------------------- END INFLUXQL CONTENT --------------------------->
|
|
||||||
{{< /tabs-wrapper >}}
|
{{< /tabs-wrapper >}}
|
||||||
|
|
||||||
## Query and visualize data
|
## Query and visualize data
|
||||||
|
|
Loading…
Reference in New Issue