In today’s data-driven world,
time series information flows constantly from countless sources:
Internet of Things (IoT) devices, system metrics, financial data streams and user interactions. To harness this temporal data effectively, you need specialized tools designed for the job. Enter the TIG stack: a powerful trio of open source tools – Telegraf, InfluxDB and
Grafana – that transforms the way we collect, store, analyze and visualize time-based data.
Why Time Series Matters
Time series data has unique characteristics that traditional databases struggle to handle efficiently. Its sequential nature, high write volumes and need for time-based querying demand purpose-built solutions. That’s what the TIG stack delivers.
Getting Started: Your TIG Stack Setup Guide
This tutorial will walk you through establishing your own time series data pipeline using:
- Telegraf for efficient data collection
- InfluxDB 3 Core or 3 Enterprise for optimized storage and retrieval
- Grafana for intuitive visualization and dashboarding
The TIG stack centers on InfluxDB, a purpose-built
time series database management system optimized for high-frequency temporal data ingestion, storage and retrieval. The system architecture supports high-cardinality time series ingestion with configurable downsampling and retention mechanisms.
This tutorial will use InfluxDB 3 Core, the newest version that has a redesigned storage layer using Apache Arrow and DataFusion for columnar data processing. The implementation achieves improved write performance through batched write-ahead log (WAL) operations, enhanced query execution via vectorized processing and reduced memory overhead through optimized schema encoding and compression techniques.
Telegraf functions as the primary data collection agent, implementing a plugin-based architecture for metric acquisition from diverse sources, including system resources, network devices, APIs and message queues.
Grafana provides the visualization and alerting layer, connecting to InfluxDB through native data source plugins that support both SQL and InfluxQL query languages. The dashboard framework renders time series data through configurable panels while the alerting engine evaluates query results against defined thresholds.
Prerequisites
Before diving in, make sure you have the following components installed:
- Telegraf: The versatile data collection agent
- InfluxDB 3 Core: The time series database foundation
- Grafana: The visualization platform (For MacOS users: `brew install grafana` followed by `brew services start grafana` will make Grafana available at http://localhost:3000.)
Alternatively, you can use Grafana Cloud for a hosted solution.
Launching InfluxDB 3 Core
After installing InfluxDB 3 Core, initialize your server with:
influxdb3serve--host-id=local01--object-storefile--data-dir~/.influxdb3
Next, create an authentication token:
influxdb3createtoken
You’ll see output similar to:
Token: apiv3_xxx
Hashed Token: zzz
Start the server with `influxdb3 serve --bearer-token zzz`
HTTP requests require the following header: "Authorization: Bearer apiv3_xxx"
The plain token (apiv3_xxx) will be used with Telegraf, while the hashed version provides security when configuring the server. This security model prevents direct exposure of authentication tokens in your configuration files or command history.
Configuring Telegraf for Data Collection
Telegraf serves as your data collection agent, gathering
metrics from various sources and forwarding them to InfluxDB. Its plugin-based architecture makes it incredibly versatile.
For this demonstration, we’ll capture system CPU metrics. Create a configuration file (`telegraf.conf`) with the following settings:
# Global configuration
[agent]
interval = "10s" # Collection interval
flush_interval = "10s" # Data flush interval
# Input Plugin: CPU Metrics
[[inputs.cpu]]
percpu = true # Collect per-CPU metrics
totalcpu = true # Collect total CPU metrics
collect_cpu_time = false # Do not collect CPU time metrics
report_active = true # Report active CPU percentage
# Output Plugin: InfluxDB v2
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8181"]
token = "your plain Token apiv3_xxx"
organization = ""
bucket = "cpu"
Important note: With InfluxDB 3 Core, you don’t need to specify an Organization ID.
Launch Telegraf with:
telegraf--configpwd/telegraf.conf--debug
Successful execution will produce log entries showing data collection and transmission:
2025-01-09T23:34:02Z I! Loading config: ./telegraf.conf
2025-01-09T23:34:02Z I! Starting Telegraf 1.26.2
2025-01-09T23:34:02Z I! Available plugins: 235 inputs, 9 aggregators, 27 processors, 22 parsers, 57 outputs, 2 secret-stores
2025-01-09T23:34:02Z I! Loaded inputs: cpu
2025-01-09T23:34:02Z I! Loaded aggregators:
2025-01-09T23:34:02Z I! Loaded processors:
2025-01-09T23:34:02Z I! Loaded secretstores:
2025-01-09T23:34:02Z I! Loaded outputs: influxdb_v2
2025-01-09T23:34:02Z I! Tags enabled: host=MacBook-Pro-4.local
2025-01-09T23:34:02Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"MacBook-Pro-4.local", Flush Interval:10s
2025-01-09T23:34:02Z D! [agent] Initializing plugins
2025-01-09T23:34:02Z D! [agent] Connecting outputs
2025-01-09T23:34:02Z D! [agent] Attempting connection to [outputs.influxdb_v2]
2025-01-09T23:34:02Z D! [agent] Successfully connected to outputs.influxdb_v2
2025-01-09T23:34:02Z D! [agent] Starting service inputs
2025-01-09T23:34:12Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2025-01-09T23:34:23Z D! [outputs.influxdb_v2] Wrote batch of 13 metrics in 792.507791ms
Verifying Data Collection
To confirm your metrics are properly stored, query InfluxDB directly:
influxdb3query--database=cpu"SELECT*FROMcpuLIMIT10"
Visualizing With Grafana
The final piece is setting up
Grafana to transform your raw data into meaningful visualizations:
- Access Grafana at http://localhost:3000
- Navigate to Connections > Data sources > Add new data source
- Search for and select “InfluxDB”
- Configure your connection:
- Click “Save & test” to verify connectivity
👁 Image
Now you’re ready to create visualizations! Navigate to Dashboards > Create Dashboard > Add Visualization, select your InfluxDB data source and use the visual query builder or write SQL directly.
👁 Image
Example query:
SELECT "cpu", "usage_user", "time" FROM "cpu"
WHERE "time" >= $__timeFrom AND "time" <= $__timeTo AND "cpu" = 'cpu0'
Next Steps
With your TIG Stack operational, you now have a powerful platform for time series data collection, storage and visualization. Some potential applications include:
- Infrastructure or product monitoring
- IoT sensor data analysis
- Application performance tracking
- Predictive analytics
The flexibility of Telegraf’s input plugins, the performance of InfluxDB 3 Core and the visualization capabilities of Grafana provide endless possibilities for time series data applications.
Start exploring your data today!
InfluxData is the creator of InfluxDB, the leading time series platform. More than 1,900 customers use InfluxDB to collect, store, and analyze all time series data at any scale. Developers can query and analyze their time-stamped data to predict, respond, and adapt in real-time.
The latest from InfluxData