Skip to main content

Grafana

TDengine can be quickly integrated with the open-source data visualization system Grafana to build a data monitoring and alerting system. The whole process does not require any code development. And you can visualize the contents of the data tables in TDengine on a dashboard. You can learn more about using the TDengine plugin on GitHub.

Prerequisites

In order for Grafana to add the TDengine data source successfully, the following preparations are required:

  1. The TDengine cluster is deployed and functioning properly
  2. taosAdapter is installed and running properly. Please refer to the taosAdapter manual for details.

Record these values:

  • TDengine REST API url: http://tdengine.local:6041.
  • TDengine cluster authorization, with user + password.

Installing Grafana

TDengine currently supports Grafana versions 7.5 and above. Users can go to the Grafana official website to download the installation package and execute the installation according to the current operating system. The download address is as follows: https://grafana.com/grafana/download.

Configuring Grafana

Install Grafana Plugin and Configure Data Source

On a server with Grafana installed, run install.sh with TDengine url and username/passwords will install TDengine data source plugin and add a data source named TDengine. This is the recommended way for Grafana 7.x or Grafana provisioning users.

bash -c "$(curl -fsSL \
https://raw.githubusercontent.com/taosdata/grafanaplugin/master/install.sh)" -- \
-a http://localhost:6041 \
-u root \
-p taosdata

Restart Grafana service and open Grafana in web-browser, usually http://localhost:3000.

Save the script and type ./install.sh --help for the full usage of the script.

Create Dashboard

Go back to the main interface to create a dashboard and click Add Query to enter the panel query page:

TDengine Database TDinsight plugin create dashboard 1

As shown above, select the TDengine data source in the Query and enter the corresponding SQL in the query box below for query.

  • INPUT SQL: Enter the desired query (the results being two columns and multiple rows), such as select _wstart, avg(mem_system) from log.dnodes_info where ts >= $from and ts < $to interval($interval). In this statement, $from, $to, and $interval are variables that Grafana replaces with the query time range and interval. In addition to the built-in variables, custom template variables are also supported.
  • ALIAS BY: This allows you to set the current query alias.
  • GENERATE SQL: Clicking this button will automatically replace the corresponding variables and generate the final executed statement.

Follow the default prompt to query the average system memory usage for the specified interval on the server where the current TDengine deployment is located as follows.

TDengine Database TDinsight plugin create dashboard 2

For more information on how to use Grafana to create the appropriate monitoring interface and for more details on using Grafana, refer to the official Grafana documentation.

Importing the Dashboard

You can install TDinsight dashboard in data source configuration page (like http://localhost:3000/datasources/edit/1/dashboards) as a monitoring visualization tool for TDengine cluster. Ensure that you use TDinsight for 3.x.

TDengine Database Grafana plugine import dashboard

A dashboard for TDengine 2.x has been published on Grafana: Dashboard 15167 - TDinsight) 。 Check the TDinsight User Manual for the details.

For more dashboards using TDengine data source, search here in Grafana. Here is a sub list:

  • 15146: Monitor multiple TDengine clusters.
  • 15155: TDengine alert demo.
  • 15167: TDinsight.
  • 16388: Telegraf node metrics dashboard using TDengine data source.