Update Grafana docs for OSS 2.0 and Cloud (#2210)

* updated influxdb oss and cloud grafana/influxql instructions, closes #1340, closes #2165

* updated grafana cloud instructions to use token auth

* updated cloud grafana config screenshot

* show auth options with influxql in grafana doc

* added tab onload js, WIP grafana rework

* updated content for influxql in grafana

* minor updates to grafana doc, closes #2211

* added information about downloading and configuring the influx cli to cloud grafana doc

* minor update in cloud grafana doc

* updated grafana influxql decision tree

* fixed some typos

* Apply suggestions from code review

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* addressed PR feedback

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
pull/2217/head
Scott Anderson 2021-02-26 18:31:19 -07:00 committed by GitHub
parent 74e6c737e5
commit 368dd4ebc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 261 additions and 39 deletions

View File

@ -480,19 +480,34 @@ Each expandable block needs a label that users can click to expand or collpase t
Pass the label as a string to the shortcode.
```md
{{% expand "Lable 1"}}
{{% expand "Label 1" %}}
Markdown content associated with label 1.
{{% /expand %}}
{{% expand "Lable 2"}}
{{% expand "Label 2" %}}
Markdown content associated with label 2.
{{% /expand %}}
{{% expand "Lable 3"}}
{{% expand "Label 3" %}}
Markdown content associated with label 3.
{{% /expand %}}
```
Use the optional `{{< expand-wrapper >}}` shortcode around a group of `{{% expand %}}`
shortcodes to ensure proper spacing around the expandable elements:
```md
{{< expand-wrapper >}}
{{% expand "Label 1" %}}
Markdown content associated with label 1.
{{% /expand %}}
{{% expand "Label 2" %}}
Markdown content associated with label 2.
{{% /expand %}}
{{< /expand-wrapper >}}
```
### Generate a list of children articles
Section landing pages often contain just a list of articles with links and descriptions for each.
This can be cumbersome to maintain as content is added.

View File

@ -20,10 +20,7 @@ var elementWhiteList = [
"a.url-trigger"
]
$('.article a[href^="#"]:not(' + elementWhiteList + ')').click(function (e) {
e.preventDefault();
var target = this.hash;
function scrollToAnchor(target) {
var $target = $(target);
$('html, body').stop().animate({
@ -31,6 +28,11 @@ $('.article a[href^="#"]:not(' + elementWhiteList + ')').click(function (e) {
}, 400, 'swing', function () {
window.location.hash = target;
});
}
$('.article a[href^="#"]:not(' + elementWhiteList + ')').click(function (e) {
e.preventDefault();
scrollToAnchor(this.hash);
});
///////////////////////////// Left Nav Interactions /////////////////////////////
@ -80,6 +82,24 @@ function tabbedContent(container, tab, content) {
tabbedContent('.code-tabs-wrapper', '.code-tabs p a', '.code-tab-content');
tabbedContent('.tabs-wrapper', '.tabs p a', '.tab-content');
//////////////////////// Activate Tabs with Query Params ////////////////////////
const queryParams = new URLSearchParams(window.location.search);
tab = queryParams.get('t')
if (tab !== null) {
var anchor = window.location.hash
var targetTab = $('.tabs a:contains("' + tab +'")')
targetTab.click()
if (anchor !== "") {
scrollToAnchor(anchor)
}
}
// TO-DO: Add/update query params when clicking a tab
/////////////////////////////// Truncate Content ///////////////////////////////
$(".truncate-toggle").click(function(e) {

View File

@ -89,6 +89,10 @@
box-shadow: 1px 3px 10px $article-shadow;
}
ul + p > img {
margin-top: 1.5rem;
}
hr {
border-width: 1px 0 0;
border-color: $article-hr;

View File

@ -1,5 +1,9 @@
// Styles for accordian-like expandable content blocks
.expand-wrapper {
margin: 2rem 0 2rem;
}
.expand {
border-top: 1px solid $article-hr;
padding: .75rem 0;
@ -47,3 +51,7 @@
&:before, &:after { transform: rotate(180deg); }
}
}
.expand-content {
padding-top: 1rem;
}

View File

@ -60,7 +60,7 @@ configure your InfluxDB connection:
- **Default Bucket**: The default [bucket](/influxdb/cloud/organizations/buckets/) to use in Flux queries.
- **Min time interval**: The [Grafana minimum time interval](https://grafana.com/docs/grafana/latest/features/datasources/influxdb/#min-time-interval).
{{< img-hd src="/img/influxdb/2-0-visualize-grafana.png" />}}
{{< img-hd src="/img/influxdb/cloud-tools-grafana.png" />}}
2. Click **Save & Test**. Grafana attempts to connect to the InfluxDB datasource
and returns the results of the test.
@ -70,35 +70,98 @@ configure your InfluxDB connection:
{{% tab-content %}}
## Configure Grafana to use InfluxQL
To query InfluxDB Cloud from Grafana using InfluxQL:
With **InfluxQL** selected as the query language in your InfluxDB data source,
configure your InfluxDB connection:
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/get-started/#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 **authentication 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/organizations/) _(by default, your email address)_
- [authentication token](/influxdb/cloud/security/tokens/)
```sh
influx config create \
--host-url https://cloud2.influxdata.com \
--org example-org \
--token My5uP3rSeCr37t0k3n \
--name example-config-name
```
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).
{{% 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
- [bucket ID](/influxdb/cloud/organizations/buckets/view-buckets/)
```sh
influx v1 dbrp create \
--db example-db \
--rp example-rp \
--bucket-id 00xX00o0X001 \
--default
```
_For more information about DBRP mapping, see [Database and retention policy mapping](/influxdb/cloud/reference/api/influxdb-1x/dbrp/)._
### 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/cloud/reference/urls/).
- **URL**: Your [InfluxDB Cloud URL](/influxdb/cloud/reference/regions/).
```sh
https://cloud2.influxdata.com
https://cloud2.influxdata.com/
```
- **Access**: Server (default)
2. Under **Auth**, enable **Basic Auth**.
3. Under **Basic Auth Details**, provide your InfluxDB authentication credentials:
2. Under **Custom HTTP Headers**, select **Add Header**. Provide your InfluxDB Cloud authentication token:
- **User**: InfluxDB username
- **Password**: InfluxDB [authentication token](/influxdb/cloud/security/tokens/)
- **Header**: Enter `Authorization`
- **Value**: Use the `Token` schema and provide your [InfluxDB authentication token](/influxdb/v2.0/security/tokens/).
For example:
4. Under **InfluxDB Details**, do the following:
```
Token y0uR5uP3rSecr3tT0k3n
```
- **Database**: Enter the ID of the bucket to query in InfluxDB Cloud. To retrieve your bucket ID, see how to [view buckets](/influxdb/cloud/organizations/buckets/view-buckets/).
- **User**: Enter the username to sign into InfluxDB.
- **Password**: Enter the token used to query the bucket above. To retrieve your token, see how to [view tokens](/influxdb/cloud/security/tokens/view-tokens/).
- **HTTP Method**: Select **GET**.
2. Under **InfluxDB Details**, do the following:
{{< img-hd src="/img/influxdb/2-0-visualize-grafana-influxql.png" />}}
- **Database**: Enter the database name [mapped to your InfluxDB Cloud bucket](#create-an-influxdb-dbrp-mapping)
- **User**: Leave empty
- **Password**: Leave empty
- **HTTP Method**: Select **GET**
5. Click **Save & Test**. Grafana attempts to connect to the InfluxDB datasource
<!-- -->
{{< img-hd src="/img/influxdb/cloud-tools-grafana-influxql.png" />}}
3. Click **Save & Test**. Grafana attempts to connect to the InfluxDB Cloud data source
and returns the results of the test.
{{% /tab-content %}}
<!--------------------------- END INFLUXQL CONTENT --------------------------->

View File

@ -31,11 +31,11 @@ influx v1 auth create [flags]
| `-o` | `--org` | Organization name (mutually exclusive with `--org-id`) | string | `$INFLUX_ORG` |
| | `--org-id` | Organization ID (mutually exclusive with `--org`) | string | `$INFLUX_ORG_ID` |
| | `--password` | Password to set on the authorization | | |
| | `--read-bucket` | Bucket ID to assign read permissions to | | |
| | `--read-bucket` | Bucket ID to assign read permissions to | stringArray | |
| | `--skip-verify` | Skip TLS certificate verification | | |
| `-t` | `--token` | Authentication token | string | `$INFLUX_TOKEN` |
| | `--username` | ({{< req >}}) Token username | string | |
| | `--write-bucket` | Bucket ID(s) to assign write permissions to | stringArray | |
| | `--write-bucket` | Bucket ID to assign write permissions to | stringArray | |
## Examples

View File

@ -59,7 +59,7 @@ configure your InfluxDB connection:
- **Default Bucket**: The default [bucket](/influxdb/v2.0/organizations/buckets/) to use in Flux queries.
- **Min time interval**: The [Grafana minimum time interval](https://grafana.com/docs/grafana/latest/features/datasources/influxdb/#min-time-interval).
{{< img-hd src="/img/influxdb/2-0-visualize-grafana.png" />}}
{{< img-hd src="/img/influxdb/2-0-tools-grafana.png" />}}
2. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 datasource
and returns the results of the test.
@ -67,10 +67,107 @@ configure your InfluxDB connection:
<!----------------------------- END FLUX CONTENT ----------------------------->
<!-------------------------- BEGIN INFLUXQL CONTENT -------------------------->
{{% tab-content %}}
## Configure Grafana to use InfluxQL
With **InfluxQL** selected as the query language in your InfluxDB data source,
configure your InfluxDB connection:
To query InfluxDB OSS 2.0 with InfluxQL, find your use case below, and then complete the instructions to configure Grafana:
- [Installed a new InfluxDB 2.0 instance](#installed-a-new-influxdb-20-instance)
- [Upgraded from InfluxDB 1.x to 2.0 (following the official upgrade)](#upgraded-from-influxdb-1x-to-20)
- [Manually migrated from InfluxDB 1.x to 2.0](#manually-migrated-from-influxdb-1x-to-20)
### Installed a new InfluxDB 2.0 instance
To configure Grafana to use InfluxQL with a new install of InfluxDB 2.0, do the following:
1. [Authenticate with InfluxDB 2.0 tokens](/influxdb/v2.0/security/tokens/).
2. [Manually create DBRP mappings](#view-and-create-influxdb-dbrp-mappings).
### Upgraded from InfluxDB 1.x to 2.0
To configure Grafana to use InfluxQL when you've upgraded from InfluxDB 1.x to
InfluxDB 2.0 (following the [official upgrade](/influxdb/v2.0/upgrade/v1-to-v2/)):
1. Authenticate using the _non-admin_ [v1 compatible authentication credentials](#view-and-create-influxdb-v1-authorizations)
created during the upgrade process.
2. Use the DBRP mappings InfluxDB automatically created in the upgrade process (no action necessary).
### Manually migrated from InfluxDB 1.x to 2.0
To configure Grafana to use InfluxQL when you've manually migrated from InfluxDB
1.x to InfluxDB 2.0, do the following:
1. If your InfluxDB 1.x instance required authentication,
[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/v2.0/security/tokens/).
2. [Manually create DBRP mappings](#view-and-create-influxdb-dbrp-mappings).
{{< expand-wrapper >}}
{{% expand "View and create InfluxDB v1 authorizations" %}}
InfluxDB OSS 2.0 provides a 1.x compatible authentication API that lets you
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 auth list`](/influxdb/v2.0/reference/cli/influx/v1/auth/list/)
to list existing InfluxDB v1 compatible authorizations.
```sh
influx v1 auth list
```
#### Create a v1 authorization
Use the [`influx v1 auth create` command](/influxdb/v2.0/reference/cli/influx/v1/auth/create/)
to grant read/write permissions to specific buckets. Provide the following:
- [bucket IDs](/influxdb/v2.0/organizations/buckets/view-buckets/) to grant read
or write permissions to
- new username
- new password _(when prompted)_
<!-- -->
```sh
influx v1 auth create \
--read-bucket 00xX00o0X001 \
--write-bucket 00xX00o0X001 \
--username example-user
```
{{% /expand %}}
{{% expand "View and create InfluxDB DBRP mappings" %}}
InfluxDB DBRP mappings associate database and retention policy combinations with
InfluxDB 2.0 [buckets](/influxdb/v2.0/reference/glossary/#bucket)
#### View existing DBRP mappings
Use the [`influx v1 dbrp list`](/influxdb/v2.0/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/v2.0/reference/cli/influx/v1/dbrp/create/)
command to create a DBRP mapping.
Provide the following:
- database name
- retention policy
- [bucket ID](/influxdb/v2.0/organizations/buckets/view-buckets/)
```sh
influx v1 dbrp create \
--db example-db \
--rp example-rp \
--bucket-id 00xX00o0X001 \
--default
```
_For more information about DBRP mapping, see [Database and retention policy mapping](/influxdb/v2.0/reference/api/influxdb-1x/dbrp/)._
{{% /expand %}}
{{< /expand-wrapper >}}
### Configure your InfluxDB connection
With **InfluxQL** selected as the query language in your InfluxDB data source settings:
1. Under **HTTP**, enter the following:
@ -81,21 +178,33 @@ configure your InfluxDB connection:
```
- **Access**: Server (default)
2. Under **Custom HTTP Headers**, select **Add Header**. Provide your InfluxDB authentication credentials:
2. Configure InfluxDB authentication:
- **Header**: "Authorization"
- **Value**: use the `Token` schema and provide your [InfluxDB authentication token](/influxdb/v2.0/security/tokens/) (for example: `Token y0uR5uP3rSecr3tT0k3n`)
- ##### Token authentication
3. Under **InfluxDB Details**, do the following:
Under **Custom HTTP Headers**, select **Add Header**. Provide your InfluxDB authentication token:
- **Database**: Enter the ID of the bucket to query in InfluxDB 2.0. To retrieve your bucket ID, see how to [view buckets](/influxdb/v2.0/organizations/buckets/view-buckets/).
- **User**: Enter the username to sign into InfluxDB.
- **Password**: Enter the token used to query the bucket above. To retrieve your token, see how to [view tokens](/influxdb/v2.0/security/tokens/view-tokens/).
- **HTTP Method**: Select **GET**.
- **Header**: Enter `Authorization`
- **Value**: Use the `Token` schema and provide your [InfluxDB authentication token](/influxdb/v2.0/security/tokens/).
For example:
{{< img-hd src="/img/influxdb/2-0-visualize-grafana-influxql.png" />}}
```
Token y0uR5uP3rSecr3tT0k3n
```
4. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 datasource
- ##### Authenticate with username and password
Under **InfluxDB Details**, do the following:
- **Database**: Enter the database name [mapped to your InfluxDB 2.0 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**
<!-- -->
{{< img-hd src="/img/influxdb/2-0-tools-grafana-influxql.png" />}}
3. Click **Save & Test**. Grafana attempts to connect to the InfluxDB 2.0 data source
and returns the results of the test.
{{% /tab-content %}}
<!--------------------------- END INFLUXQL CONTENT --------------------------->

View File

@ -0,0 +1,3 @@
<div class="expand-wrapper">
{{ .Inner }}
</div>

View File

@ -1,5 +1,5 @@
{{ $expandLabel := .Get 0 }}
<div class="expand">
<div class="expand" id="{{ $expandLabel | anchorize }}">
<p class="expand-label">
<span class="expand-toggle"></span><span>{{ $expandLabel }}</span>
</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB