InfluxDB 2.x is a purpose-built time-series database that stores metrics with nanosecond precision and exposes a powerful query language called Flux for aggregating and transforming that data. Telegraf is the official plugin-driven metrics collection agent from InfluxData — it ships over 200 input plugins covering everything from CPU and memory to Docker containers and SNMP devices, all configurable through a single TOML file. Together they form a production-ready metrics pipeline that integrates natively with Grafana, allowing you to build rich dashboards without running a full Prometheus stack. In this tutorial you will install both tools on RHEL 8 using the official InfluxData repository, complete the initial InfluxDB setup, configure Telegraf to collect system metrics, and connect everything to Grafana for visualisation.
Prerequisites
- A RHEL 8 server with at least 2 GB RAM and 20 GB free disk space
- A non-root user with
sudoprivileges - EPEL 8 enabled:
dnf install -y epel-release - Grafana installed and running on port 3000
- Port 8086 open (or to be opened) in
firewalld curlavailable:dnf install -y curl
Step 1 — Add the InfluxData Repository and Install InfluxDB 2
InfluxData maintains an official YUM repository for RHEL-based systems. Add the repository file, then install both the InfluxDB server and the CLI client in a single dnf command.
# Add the InfluxData YUM repository
cat <<'EOF' | sudo tee /etc/yum.repos.d/influxdata.repo
[influxdata]
name = InfluxData Repository
baseurl = https://repos.influxdata.com/rhel/8/x86_64/stable/
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
EOF
# Install InfluxDB server and CLI
sudo dnf install -y influxdb2 influxdb2-cli
# Enable and start the service
sudo systemctl enable --now influxd
sudo systemctl status influxd
Step 2 — Open the Firewall Port and Run Initial Setup
Allow traffic on port 8086, then use the influx setup command to create the initial admin user, organisation, and default bucket. The API token generated during setup is used by Telegraf and Grafana to authenticate.
# Open port 8086
sudo firewall-cmd --permanent --add-port=8086/tcp
sudo firewall-cmd --reload
# Run interactive setup — answer each prompt
influx setup
# Example responses:
# Primary username: admin
# Admin password: (choose a strong password)
# Confirm password: (repeat)
# Primary org name: progressiverobot
# Primary bucket name: servers
# Retention period: 30d
# Confirm? (y/n): y
# The CLI prints an operator token — copy it immediately.
# You can also retrieve tokens at any time:
influx auth list
Step 3 — Install Telegraf
Telegraf is available in the same InfluxData repository you added in Step 1. Install it with dnf and verify the binary is available before modifying its configuration.
sudo dnf install -y telegraf
# Verify the version
telegraf --version
# The default configuration file is created at /etc/telegraf/telegraf.conf
# Back it up before making changes
sudo cp /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.bak
Step 4 — Configure Telegraf Input and Output Plugins
Edit /etc/telegraf/telegraf.conf to enable the CPU, disk, memory, and network input plugins, and point the InfluxDB v2 output plugin at the local InfluxDB instance using the token from Step 2. Replace the placeholder token, organisation, and bucket values with your own.
sudo tee /etc/telegraf/telegraf.conf <<'EOF'
# Global agent settings
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = ""
omit_hostname = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
[[outputs.influxdb_v2]]
urls = ["http://127.0.0.1:8086"]
token = "REPLACE_WITH_YOUR_OPERATOR_TOKEN"
organization = "progressiverobot"
bucket = "servers"
###############################################################################
# INPUT PLUGINS #
###############################################################################
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.mem]]
[[inputs.net]]
interfaces = ["eth0", "ens3", "ens5"] # adjust to your interface names
[[inputs.system]]
[[inputs.processes]]
EOF
Step 5 — Enable and Start the Telegraf Service
Reload the systemd daemon to pick up any unit file changes, enable Telegraf at boot, start it, and verify that metrics are flowing into InfluxDB.
sudo systemctl daemon-reload
sudo systemctl enable --now telegraf
sudo systemctl status telegraf
# Check Telegraf logs for output errors
sudo journalctl -u telegraf -n 50
# Verify data is arriving in InfluxDB (replace token and org)
influx query
--org progressiverobot
--token "REPLACE_WITH_YOUR_OPERATOR_TOKEN"
'from(bucket:"servers") |> range(start: -5m) |> filter(fn:(r) => r._measurement == "cpu") |> limit(n:5)'
Step 6 — Visualise Metrics in Grafana
Add InfluxDB as a data source in Grafana and build a dashboard panel to display CPU usage over time. Use Flux as the query language for full access to InfluxDB 2 features.
# In Grafana:
# 1. Go to Connections → Data sources → Add data source → InfluxDB
# 2. Query language: Flux
# 3. URL: http://localhost:8086
# 4. Organisation: progressiverobot
# 5. Token:
# 6. Default bucket: servers
# 7. Click "Save & test"
# Example Flux query — CPU usage % (non-idle) averaged across all cores:
from(bucket: "servers")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "cpu" and r._field == "usage_idle" and r.cpu == "cpu-total")
|> map(fn: (r) => ({r with _value: 100.0 - r._value}))
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
# Example Flux query — available memory in GB:
from(bucket: "servers")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "mem" and r._field == "available")
|> map(fn: (r) => ({r with _value: float(v: r._value) / 1073741824.0}))
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
Conclusion
You now have a fully operational InfluxDB 2 and Telegraf metrics pipeline running on RHEL 8, collecting CPU, disk, memory, network, and process metrics every ten seconds and storing them in a time-series bucket with a 30-day retention policy. Grafana queries that bucket using the Flux language, giving you expressive, server-side aggregation capabilities that are not available with PromQL. This stack scales naturally — simply install the Telegraf agent on additional hosts, point them at the same InfluxDB instance, and differentiate their data with the built-in host tag that Telegraf attaches automatically.
Next steps: How to Set Up Grafana Alerting and Notification Channels on RHEL 8, How to Configure Prometheus Node Exporter on RHEL 8, and How to Install Graylog for Centralised Log Management on RHEL 8.