Operations 18 min read

Grafana + InfluxDB: Build CPU Monitoring Dashboard in 10 Minutes (Template ID 13978)

This tutorial guides you through installing Grafana 8.5.2 on Linux, connecting it to InfluxDB as a data source, and importing a pre-built dashboard template (ID 13978) to visualize CPU usage trends, peaks, and valleys without writing queries, plus troubleshooting tips for common connection issues.

Engineer Tang's Implementation Study Notes
Engineer Tang's Implementation Study Notes
Engineer Tang's Implementation Study Notes
Grafana + InfluxDB: Build CPU Monitoring Dashboard in 10 Minutes (Template ID 13978)

Introduction

The previous article covered advanced InfluxDB queries — filtering, aggregation, and min/max operations — so you can precisely extract the data you need. However, the command line is not intuitive for spotting fluctuations, peaks, and valleys at a glance. This article focuses on integrating Grafana with InfluxDB to turn time-series data into clear line charts and dashboards. The steps are beginner-friendly: copy commands, follow the procedure, and get up and running in about 10 minutes.

What Is Grafana?

Grafana is an open-source monitoring dashboard system developed by Grafana Labs. Its core value is simplifying monitoring complexity: you provide the data, and it automatically generates visualizations. It also includes alerting so you are notified when problems occur without staring at data constantly.

In plain terms, Grafana is an open-source visualization tool whose sole purpose is to transform dull database data into intuitive, attractive charts (line charts, bar charts, gauges) so you can instantly see trends, peaks, and troughs without manual plotting.

Example: You store 7 days of CPU metrics in InfluxDB. The CLI only shows raw numbers, making it hard to spot the highest usage or when spikes occurred. With Grafana connected, a line chart reveals the 7-day trend instantly, even annotating peak times for faster troubleshooting. Add alerts, and you get proactive notifications when thresholds are breached.

Remember three key points:

Grafana does not store data — it is a display panel that must connect to a database (InfluxDB, MySQL, etc.) to read and visualize data.

Built for time-series databases — it supports virtually all mainstream TSDBs (Prometheus, Graphite, OpenTSDB, InfluxDB…). InfluxDB is its golden partner ; production monitoring of servers, sensors, and meters typically uses this pair.

Relational databases work too — MySQL, PostgreSQL, SQL Server are also supported, making Grafana a true "visualization ceiling" — learn it once and handle monitoring visualization at any company.

Why Grafana + InfluxDB?

InfluxDB stores time-series data; Grafana visualizes it. The combination boils down to three benefits:

Ditch the CLI, see data at a glance — no more typing tedious queries; open a browser to see charts with trends, peaks, and valleys clearly.

Purpose-built for time-series data — Grafana natively handles time-varying metrics (CPU usage, power consumption), auto-aggregates by time, and produces trend charts far more professional than generic tables.

Beginner-friendly, zero code — no development skills needed; the entire workflow is visual. Click through steps, import a template, and produce a professional monitoring dashboard in minutes.

In short: InfluxDB handles "storage", Grafana handles "display". Together they efficiently store time-series data and intuitively show trends — the most common production pairing.

Prerequisites (Check These First to Avoid Pitfalls)

Before linking the two, confirm three things:

InfluxDB is already running and contains data.

You have recorded three critical InfluxDB details (covered in the previous article):

Organization name (org) and bucket name

Access token (the "key" to connect to InfluxDB)

Server IP (localhost for local, public IP for remote)

Server ports are open: InfluxDB on 8086, Grafana on 3000. Local deployments can skip this; remote deployments must open them (commands provided later).

Hands-On Steps: Grafana Install + InfluxDB Integration (Linux, CentOS/Ubuntu)

The process has four phases: install Grafana → initialize configuration → connect InfluxDB data source → create dashboard. All commands are provided for copy-paste execution.

Step 1: Install Grafana (Stable Version 8.5.2)

The chosen version is Grafana 8.5.2 — stable, compatible with InfluxDB, and beginner-friendly. Run the following commands sequentially; installation is fully automated.

# 1. Install dependencies (choose one for your OS)
sudo yum install -y fontconfig freetype* libfreetype.so.6  # CentOS
# sudo apt install -y fontconfig freetype2 libfreetype6  # Ubuntu (comment out the above, run this)

# 2. Download Grafana package (official URL often fails; replaced with Tsinghua mirror for stability)
wget https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/grafana-8.5.2-1.x86_64.rpm

# 3. Install Grafana
sudo rpm -ivh grafana-8.5.2-1.x86_64.rpm

# 4. Start Grafana and enable auto-start on boot
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

# 5. Verify startup status (active = success)
sudo systemctl status grafana-server

Note: The official download URL (https://dl.grafana.com/oss/release/grafana-8.5.2-1.x86_64.rpm) frequently fails to resolve, so the Tsinghua mirror is used for faster, reliable downloads.

Remote deployment mandatory — open port 3000: Grafana defaults to port 3000. Run these commands to allow external access:

firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload

Step 2: Grafana Initialization (Two Simple Steps)

After installation, open a browser to complete setup:

Visit http://your-server-IP:3000 (or http://localhost:3000 for local).

Log in with default credentials: username admin, password admin (remember them).

You will be prompted to change the password (the default is weak). Set a memorable one; if forgotten, a reset method exists.

After password change, you land on the home page ready to add the InfluxDB data source (the main event).

Step 3: Add InfluxDB Data Source (Critical — Lets Grafana Read InfluxDB Data)

This step connects Grafana to your InfluxDB instance. No code required; just click through the UI:

Home page → left sidebar "Configuration" (gear icon) → "Data Sources".

Click "Add data source", search for "InfluxDB", and select "InfluxDB" (do not pick similar entries).

Configure the data source (key fields — fill exactly as below; leave others default):

URL: http://your-server-IP:8086 (matches InfluxDB address; local uses http://localhost:8086).

Organization: Your InfluxDB org name (set during initialization, e.g., my-org).

Token: Your InfluxDB token (copy-paste exactly, no extra spaces).

Default Bucket: Choose the bucket to visualize (e.g., my-bucket); it must contain data or charts will be empty.

Click "Save & Test" at the bottom. "Data source is working" confirms success. If it fails, re-check the four parameters above.

Step 4: Create Monitoring Dashboard (Beginners: Import Template, Don't Design from Scratch)

No need to build charts manually. Grafana offers ready-made templates; import and go:

Home page → left "+" icon → "Import".

In "Import via grafana.com" enter template ID: 13978 (this template is tailored for InfluxDB CPU monitoring, includes line charts, max, and average values). Click "Load".

In "Select a data source" dropdown, choose the InfluxDB data source you just added (wrong selection = no data). Click "Import".

Wait ~10 seconds. A complete CPU monitoring dashboard appears — showing CPU idle rate, user usage line charts, real-time values, and peak statistics. Trends are instantly clear.

Advanced: Custom Charts for Your Own Data (e.g., Power Meters, Sensors)

To monitor non-CPU data (power meters, sensors), add a custom panel in the dashboard:

In the dashboard, click top-right "Add panel" → "Add a new panel".

In the "Query" tab, select the InfluxDB data source and define the query visually (no manual writing):

Choose bucket and measurement (e.g., meter).

Select fields to display (e.g., power for wattage, voltage for voltage).

Pick aggregation (e.g., mean for average, max for peak — same logic as InfluxDB queries).

Switch to "Visualization" tab, choose chart type (line for trends, bar for comparisons, gauge for real-time values).

Click "Apply" top-right. The custom chart is added.

5 Beginner Pitfalls (Check These If Integration Fails)

Common mistakes and fixes:

Pitfall 1: Grafana download fails with "webpage resolution failed"

Fix: Use the Tsinghua mirror URL provided in Step 1; do not use the official URL.

Pitfall 2: Grafana-to-InfluxDB connection fails

Fix: Verify three things — URL includes port 8086, token is correct, InfluxDB is running.

Pitfall 3: Template imported but charts show no data

Fix: First confirm the InfluxDB bucket actually has data (run a query from the previous article). Then ensure the template's selected data source and bucket name match.

Pitfall 4: Remote Grafana inaccessible in browser

Fix: Confirm server port 3000 is open (run the firewall commands from Step 1), then refresh.

Pitfall 5: Forgot Grafana admin password

Fix: Run sudo grafana-cli admin reset-admin-password newpassword, then log in again.

Practice Exercises

Combine with the previous article's InfluxDB data and complete two exercises to truly master the workflow:

Follow the article to install Grafana and successfully connect to the InfluxDB data source (see "Data source is working").

Import template 13978, view the CPU monitoring dashboard, then add a custom panel to display power meter data ( power field) trend.

Tip: When errors occur, troubleshoot against the five pitfalls above — most issues resolve there. If not, verify InfluxDB data is normal and all parameters are entered correctly.

Summary

Today we did one thing: integrate Grafana with InfluxDB. Core four steps — install Grafana, initialize, connect data source, import template/add charts.

No need to memorize complex configs. Just remember:

Grafana = visualization tool, InfluxDB = database . The integration key is correct data-source parameters; template imports save 80% of the effort.

Master this, and whether you monitor servers, power meters, or sensor data, you can produce professional monitoring panels — no more staring at the CLI, just one glance reveals data trends.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

MonitoringlinuxDashboardtime-series databaseTutorialInfluxDBTemplateGrafana
Engineer Tang's Implementation Study Notes
Written by

Engineer Tang's Implementation Study Notes

Old Tang | Pseudo-full-stack tech player: writes code without going bald, manages projects without going crazy, delivers without staying up late. No formal tutorials here, only a "slacking-off" practical manual that cures system pain points. Focuses on Shell, SQL, Java, and delivery, turning complexity into simplicity and making efficiency fun.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.