All Products
Document Center

Connect Grafana to a TSDB for InfluxDB®️ instance

Last Updated: May 19, 2022

Grafana is a widely adopted tool that is used to visualize time series data in Internet application analysis. Grafana is used in various fields, such as industrial monitoring, meteorological monitoring, home automation, and process management. After you connect a TSDB for InfluxDB® instance to Grafana, you can use various easy-to-use visualization tools in Grafana to monitor and analyze the data in the TSDB for InfluxDB® instance. This topic describes how to connect a TSDB for InfluxDB® instance to Grafana.


A TSDB for InfluxDB® instance is created. After you purchase an instance, create an account, a database, and a storage policy. Grant the account the permissions to access the database. For more information, see Manage user accounts and databases. Write data to the database. Grafana can generate visualized charts based on the data.


  1. Download and install Grafana.

    Download Grafana from the Grafana official website. This web page describes how to install Grafana for different OSs. You can obtain the installation package that is suitable for your system OS and configuration.

    sudo yum localinstall grafana-6.1.4-1.x86_64.rpm
  2. Start and log on to Grafana.

    After Grafana is installed, run the command that is suitable for your OS to start Grafana.

    In CentOS, run the following command:

    service grafana-server start

    In macOS, run the following command:

    brew services start grafana

    After Grafana is started, enter the IP address and port that can be used to access Grafana in the address bar of your browser. By default, Grafana listens on port 3000. If Grafana is hosted on your local machine, enter in the address bar. If Grafana is hosted on an Elastic Compute Service (ECS) instance, use the public endpoint of the ECS instance to access Grafana. You can check the public endpoint of the ECS instance in the ECS console.

    The default administrator account of Grafana is admin. The default password of this account is admin. You can change the default password of the administrator account based on your needs.

  3. Go to the page for data source configuration.

    On the homepage, click Add data source. The page for data source configuration appears.

  4. Configure the following parameters.




    Select InfluxDB.


    Enter the public endpoint of the TSDB for InfluxDB® instance.


    Perform the following steps to view the public endpoint of the instance: In the left-side navigation pane of the TSDB for InfluxDB® console, click Instances. In the Actions column for the instance, click Manage. Then, you can find the public endpoint of the instance.

    InfluxDB Details

    The database that you want to access and the username and password that can be used to access the database.

  5. Create and configure a dashboard.

    Create a dashboard

    Dashboards are used to visualize data in Grafana. Grafana queries data from TSDB for InfluxDB® based on query rules. Then, the queried data is displayed on dashboards. In the following example, a dashboard of the gragh type is created and configured.

    1. Click the Create icon and then click Dashboard.

    2. Click Graph.

    Create query rules

    1. Choose Panel Title > Edit.

    2. On the page that appears, create query rules. Multiple clauses are available. Perform the following steps to create query rules.

      • In the Data Source field, select a data source.

      • Enter the name of the storage policy in the first text box after FROM. Enter a measurement name in the second text box after FROM.

      • Specify one or more tag filters after WHERE.

      • Specify a field and one or more aggregate functions after SELECT. You must specify aggregate functions if you use the GROUP BY clause to group data by time. The aggregate functions are executed from left to right. For example, you can specify multiple aggregate functions, as shown in the following figure.

        In TSDB for InfluxDB®, the preceding aggregate functions are organized in the following SELECT clause:

        SELECT derivative(mean("field10"),10s)/10 AS "REQ/s" FROM ....
      • Click the plus icon after GROUP BY to specify conditions to group data. You can group data by time or by tag. You can also specify the ordering rule and limits.

      • In the drop-down list after FORMAT AS, select a display mode.

      • In the ALIAS BY field, enter an alias for the measurement or tag.

      • Click Add Query to configure multiple query rules.

    3. In the upper part of the page, click the Save icon.

Visualized query results

The query results are immediately displayed in a graph based on the specified query rules. The following figure provides an example.