diff --git a/content/influxdb/cloud-dedicated/process-data/visualize/grafana.md b/content/influxdb/cloud-dedicated/process-data/visualize/grafana.md index 5a6cab60b..cc3c88876 100644 --- a/content/influxdb/cloud-dedicated/process-data/visualize/grafana.md +++ b/content/influxdb/cloud-dedicated/process-data/visualize/grafana.md @@ -2,7 +2,8 @@ title: Use Grafana to query and visualize data list_title: Use Grafana description: > - Install and run [Grafana](https://grafana.com/) to query and visualize data stored in InfluxDB. + Install and run [Grafana](https://grafana.com/) to query and visualize data + stored in InfluxDB. weight: 201 menu: influxdb_cloud_dedicated: @@ -16,7 +17,7 @@ aliases: - /influxdb/cloud-dedicated/process-data/tools/grafana/ --- -Use [Grafana](https://grafana.com/) to query data stored in +Use [Grafana](https://grafana.com/) to query and visualize data stored in {{% cloud-name %}}. {{% cloud-name %}} supports both **SQL** and **InfluxQL** query languages. Install the [Grafana FlightSQL plugin](https://grafana.com/grafana/plugins/influxdata-flightsql-datasource/) @@ -28,7 +29,7 @@ Use the **InfluxDB** core Grafana plugin to query data with **InfluxQL**. > [Grafana] provides you with tools to turn your time-series database (TSDB) > data into insightful graphs and visualizations. > -> {{% caption %}}[Grafana documentation](https://grafana.com/docs/grafana/latest/introduction/){{% /caption %}} +> {{% cite %}}[Grafana documentation](https://grafana.com/docs/grafana/latest/introduction/){{% /cite %}} @@ -54,6 +55,14 @@ If using **Grafana Cloud**, login to your Grafana Cloud instance. If you want to query {{% cloud-name %}} with **SQL**, install the [Grafana FlightSQL plugin](https://grafana.com/grafana/plugins/influxdata-flightsql-datasource/). +{{% note %}} +#### Only required if using SQL + +Installing the Grafana FlightSQL plugin is only required if using **SQL** to query +data from InfluxDB. If using **InfluxQL**, enable the +[Grafana InfluxDB core plugin](/influxdb/cloud-dedicated/process-data/visualize/grafana/?t=InfluxQL#create-a-datasource). +{{% /note %}} + {{< tabs-wrapper >}} {{% tabs %}} [Local Grafana](#) diff --git a/content/influxdb/cloud-serverless/process-data/visualize/grafana.md b/content/influxdb/cloud-serverless/process-data/visualize/grafana.md index 38f8fdd63..8a1c8a8fa 100644 --- a/content/influxdb/cloud-serverless/process-data/visualize/grafana.md +++ b/content/influxdb/cloud-serverless/process-data/visualize/grafana.md @@ -35,7 +35,7 @@ to query InfluxDB with the Flight SQL protocol. - [Install the FlightSQL plugin](#install-the-flightsql-plugin) - [Use grafana-cli](#use-grafana-cli) - [Use the Grafana UI](#use-the-grafana-ui) -- [Create and configure a FlightSQL datasource](#create-and-configure-a-flightsql-datasource) +- [Create a datasource](#create-a-datasource) - [Query InfluxDB with Grafana](#query-influxdb-with-grafana) - [Build visualizations with Grafana](#build-visualizations-with-grafana) @@ -50,6 +50,17 @@ If using **Grafana Cloud**, login to your Grafana Cloud instance. ## Install the FlightSQL plugin +If you want to query {{% cloud-name %}} with **SQL**, install the +[Grafana FlightSQL plugin](https://grafana.com/grafana/plugins/influxdata-flightsql-datasource/). + +{{% note %}} +#### Only required if using SQL + +Installing the Grafana FlightSQL plugin is only required if using **SQL** to query +data from InfluxDB. If using **InfluxQL**, enable the +[Grafana InfluxDB core plugin](/influxdb/cloud-serverless/process-data/visualize/grafana/?t=InfluxQL#create-a-datasource). +{{% /note %}} + {{< tabs-wrapper >}} {{% tabs %}} [Local Grafana](#) @@ -98,7 +109,21 @@ Grafana Cloud instance. {{% /tab-content %}} {{< /tabs-wrapper >}} -## Create and configure a FlightSQL datasource +## Create a datasource + +Which datasource you create depends on which query language you want to use to +query {{% cloud-name %}}: + +- To query with **SQL**, create a **FlightSQL** datasource. +- To query with **InfluxQL**, create an **InfluxDB** datasource. + +{{< tabs-wrapper >}} +{{% tabs %}} +[SQL](#) +[InfluxQL](#) +{{% /tabs %}} +{{% tab-content %}} + 1. In your Grafana user interface (UI), navigate to **Data Sources**. 2. Click **Add new data source**. @@ -132,11 +157,62 @@ Grafana Cloud instance. If successful, click **Explore** to begin querying InfluxDB with Flight SQL and Grafana. + +{{% /tab-content %}} +{{% tab-content %}} + + +{{% note %}} +#### Map databases and retention policies to buckets + +To query {{% cloud-name %}} with InfluxQL, first map database and retention policy +(DBRP) combinations to your InfluxDB Cloud buckets. For more information, see +[Map databases and retention policies to buckets](/influxdb/cloud-serverless/query-data/influxql/dbrp/). +{{% /note %}} + +1. In your Grafana user interface (UI), navigate to **Data Sources**. +2. Click **Add new data source**. +3. Search for and select the **InfluxDB** core plugin. +4. Provide a name for your datasource. +5. Under **Query Language**, select **InfluxQL**. +6. Under **HTTP**: + + - **URL**: Provide your [{{% cloud-name %}} region URL](/influxdb/cloud-serverless/reference/regions/) + using the HTTPS protocol: + + ``` + https://cloud2.influxdata.com + ``` + +7. Under **InfluxDB Details**: + + - **Database**: Provide a default database (bucket) name to query. + - **User**: Provide an arbitrary string. + _This credential is ingored when querying {{% cloud-name %}}, but it cannot be empty._ + - **Password**: Provide an [API token](/influxdb/cloud-serverless/admin/tokens/) + with read access to the buckets you want to query. + +7. Click **Save & test**. + + {{< img-hd src="/img/influxdb/cloud-serverless-grafana-influxdb-datasource.png" alt="Grafana InfluxDB datasource for InfluxDB Cloud Serverless" />}} + + +{{% /tab-content %}} +{{< /tabs-wrapper >}} + ## Query InfluxDB with Grafana -After you [configure and save a FlightSQL datasource](#create-and-configure-a-flightsql-datasource), +After you [configure and save a FlightSQL or InfluxDB datasource](#create-a-datasource), use Grafana to build, run, and inspect queries against your InfluxDB bucket. +{{< tabs-wrapper >}} +{{% tabs %}} +[SQL](#) +[InfluxQL](#) +{{% /tabs %}} +{{% tab-content %}} + + {{% note %}} {{% sql/sql-schema-intro %}} To learn more, see [Query Data](/influxdb/cloud-serverless/query-data/sql/). @@ -155,7 +231,29 @@ To learn more, see [Query Data](/influxdb/cloud-serverless/query-data/sql/). SQL will return the aggregation for each group or partition. 4. Click **Run query** to execute the query. -{{< img-hd src="/img/influxdb/cloud-serverless-grafana-flightsql-explore-query-1.png" alt="Grafana Flight SQL datasource query" />}} +{{< img-hd src="/img/influxdb/cloud-serverless-grafana-flightsql-explore-query.png" alt="Grafana Flight SQL datasource query" />}} + + +{{% /tab-content %}} +{{% tab-content %}} + + +1. Click **Explore**. +2. In the dropdown, select the **InfluxDB** data source that you want to query. +3. Use the InfluxQL query form to build your query: + - **FROM**: Select the measurement that you want to query. + - **WHERE**: To filter the query results, enter a conditional expression. + - **SELECT**: Select fields to query and an aggregate function to apply to each. + The aggregate function is applied to each time interval defined in the + `GROUP BY` clause. + - **GROUP BY**: By default, Grafana groups data by time to downsample results + and improve query performance. + You can also add other tags to group by. +4. Click **Run query** to execute the query. + + +{{% /tab-content %}} +{{< /tabs-wrapper >}} To learn about query management and inspection in Grafana, see the [Grafana Explore documentation](https://grafana.com/docs/grafana/latest/explore/). diff --git a/static/img/influxdb/cloud-dedicated-grafana-flightsql-datasource.png b/static/img/influxdb/cloud-dedicated-grafana-flightsql-datasource.png index 8ebde03f6..1b5359847 100644 Binary files a/static/img/influxdb/cloud-dedicated-grafana-flightsql-datasource.png and b/static/img/influxdb/cloud-dedicated-grafana-flightsql-datasource.png differ diff --git a/static/img/influxdb/cloud-serverless-grafana-flightsql-datasource.png b/static/img/influxdb/cloud-serverless-grafana-flightsql-datasource.png index 268d84ec8..743818e07 100644 Binary files a/static/img/influxdb/cloud-serverless-grafana-flightsql-datasource.png and b/static/img/influxdb/cloud-serverless-grafana-flightsql-datasource.png differ diff --git a/static/img/influxdb/cloud-serverless-grafana-flightsql-explore-query-1.png b/static/img/influxdb/cloud-serverless-grafana-flightsql-explore-query.png similarity index 100% rename from static/img/influxdb/cloud-serverless-grafana-flightsql-explore-query-1.png rename to static/img/influxdb/cloud-serverless-grafana-flightsql-explore-query.png diff --git a/static/img/influxdb/cloud-serverless-grafana-influxdb-datasource.png b/static/img/influxdb/cloud-serverless-grafana-influxdb-datasource.png new file mode 100644 index 000000000..24b330cb6 Binary files /dev/null and b/static/img/influxdb/cloud-serverless-grafana-influxdb-datasource.png differ