Grafana does not store data itself. It acts as a visualization middle layer that connects to data sources and renders query results as charts. By installing the appropriate data source plugin, Grafana can connect to nearly every mainstream time-series database, including TDengine, InfluxDB, and Prometheus.
How the integration works
After you configure a data source connection in Grafana, the flow follows three steps. First, Grafana sends a query request through the data source’s API. Second, the time-series database receives the request, runs the query, and returns the results. Third, Grafana renders the structured data according to the chart type you selected in the panel configuration.
This architecture keeps data storage and visualization separate. Each layer scales and is maintained independently. You can upgrade Grafana without touching the database, and vice versa.
Data source configuration
The setup process follows a standard sequence:
- Install the data source plugin for your database.
- In Grafana, go to Configuration, then Data Sources.
- Click Add data source and select your database type (for example, TDengine).
- Fill in the connection details: HTTP URL (
http://hostname:6041), Database name, User, and Password. - Click Save and test to verify the connection.
A successful test confirms that Grafana can reach the database and authenticate. If the test fails, check that the port is open, the credentials are correct, and the database service is running.
Query syntax and data filtering
Here is a typical query that retrieves sensor data for a specific location:
SELECT _rowts, temperature
FROM sensors
WHERE location = 'Building-A'
ORDER BY _rowts DESC
LIMIT 100
_rowts is a special column in time-series databases that represents the timestamp of each data record. It serves as the primary time axis for all chart types.
Grafana provides a visual query builder for constructing queries without writing SQL manually. Users who are comfortable with SQL can switch to the text edit mode and write queries directly. The text mode gives you full control over filtering, aggregation, and time-range selection.
Dashboard creation and panel types
Each Grafana dashboard is built from panels. Choosing the right panel type for each metric makes the difference between a useful dashboard and a confusing one.
Time series panel. The most widely used panel type. Data points are connected chronologically into a line chart. This panel is the default choice for trend analysis: CPU utilization over time, request latency over time, temperature fluctuations over a shift.
Gauge panel. Displays the current value on a circular scale, showing the relationship between the current reading and target ranges. Gauges work well for instantaneous metrics like current CPU usage, memory pressure, or disk fill percentage.
Stat panel. Shows a single large number representing the current value. Stat panels are effective for KPI metrics: total requests today, current active sessions, remaining disk capacity. The visual simplicity draws attention to the number that matters most.
Table panel. Displays data in rows and columns with specific numerical values. Tables support conditional formatting to highlight values that exceed thresholds. This panel is useful when you need to see exact numbers across multiple dimensions, such as per-device error counts or per-region throughput.
Variables and dynamic dashboards
Variables make dashboards interactive. Instead of hardcoding a device name or a location into every query, you define a variable and let the viewer select a value from a dropdown, checkbox, or multi-select list.
Variable values can come from a data source query, a manually entered list, or URL parameters. A single dashboard template can then serve multiple monitoring targets. For example, a server monitoring dashboard with a variable for hostname can be reused across every server in a cluster. The viewer selects a host and all panels update to reflect that selection.
Organization and sharing
Use folders to group dashboards by business line, application, environment, or any other dimension relevant to your team. Folders support permission controls, so different teams can manage their own dashboards without seeing or modifying each other’s work.
Sharing options include a share link that allows viewing without login, iframe embedding for integration into other web pages, and direct links for bookmarking. Export and import work through JSON files: you can back up your dashboards manually, or import community templates from the Grafana dashboard gallery.
Summary
Configuring data sources correctly, building effective queries, choosing the right panel types, and using variables and permission controls together create a strong data monitoring and visualization platform. A well-built Grafana dashboard turns raw time-series data into actionable insight, whether you are monitoring infrastructure, tracking IoT device metrics, or analyzing application performance.


