How to Install and Use Grafana for Real-Time Data Visualization

Grafana is a powerful, self-hosted tool that turns complex metrics into clear, interactive dashboards and real-time charts. The best part is that you can install Grafana on multiple platforms via Docker, making setup quick, clean, and platform-agnostic. This guide will show you how to install Grafana using Docker and how to use it to effectively monitor system metrics and visualize real-time data.

 

Install Grafana using Docker

Before installing Grafana, make sure Docker is installed on your system.

To get started, execute the following command to pull the Grafana image:

sudo docker pull grafana/grafana

How to Install and Use Grafana for Real-Time Data Visualization Picture 1

Now, start a new Grafana container in the background and map it to port 3000 with the following command:

sudo docker run -d -p 3000:3000 --name=grafana grafana/grafana

How to Install and Use Grafana for Real-Time Data Visualization Picture 2

 

After running the Docker container, open your browser and go to http://localhost:3000 to access the Grafana dashboard. Use the default username and password, both set to admin , to log in to Grafana:

How to Install and Use Grafana for Real-Time Data Visualization Picture 3

After you hit the login button, it will prompt you to update your password to avoid security risks. You can update and submit (recommended) the modified password or skip to continue with the default password:

How to Install and Use Grafana for Real-Time Data Visualization Picture 4

After you log in successfully, the following dashboard will appear:

How to Install and Use Grafana for Real-Time Data Visualization Picture 5

 

Apart from Grafana, you can also use any of these tools to monitor your Linux system.

Connect data sources and visualize data

Grafana lets you monitor multiple services and containers from a single dashboard. You can add multiple data sources (like Prometheus, MySQL, MongoDB, etc.) and visualize your data with pre-built or custom dashboards.

Let's connect Prometheus as our first data source. To do this, we'll install and run Prometheus using Docker:

sudo docker pull prom/prometheus

How to Install and Use Grafana for Real-Time Data Visualization Picture 6

Run the Prometheus container using the following command:

sudo docker run -d -p 9090:9090 --name=prometheus prom/prometheus

How to Install and Use Grafana for Real-Time Data Visualization Picture 7

Once the container is running, you can access the Prometheus web interface by visiting http://your_ip:9090.

Add data source

Now that Grafana and Prometheus are up and running, you can start by adding your first data source:

How to Install and Use Grafana for Real-Time Data Visualization Picture 8

Select the data source you want to add, then enter the URL , such as http://your_ip:9090. Then click Save & Test and you should get the following message: Successfully queried the Prometheus API .

How to Install and Use Grafana for Real-Time Data Visualization Picture 9

 

Create your first dashboard

Once connected, you can create dashboards to visualize your metrics with graphs, charts, and other dashboards. To do this, click the Create Dashboard button or New -> New dashboard .

How to Install and Use Grafana for Real-Time Data Visualization Picture 10

Now, click the + Add a new visualization button to start a new dashboard by adding a visualization:

How to Install and Use Grafana for Real-Time Data Visualization Picture 11

Finally, select Prometheus as the data source:

How to Install and Use Grafana for Real-Time Data Visualization Picture 12

Use any of the available metrics, e.g. process_cpu_seconds_total and click the Run Queries button to visualize the data:

How to Install and Use Grafana for Real-Time Data Visualization Picture 13

Similarly, you can add more visualizations (like CPU usage, memory, etc.) and drag and drop them into your layout.

This way, you can build real-time interactive views of your system or application data for easier monitoring and analysis.

Use the pre-built dashboard

Grafana allows importing community dashboards. For example, you can go to the official Grafana website and use any of the pre-built dashboards:

How to Install and Use Grafana for Real-Time Data Visualization Picture 14

To use a pre-built dashboard, you can copy the ID of any dashboard from the official website and paste it into the Grafana dashboard section.

Now that Grafana is up and running, the next step is to explore advanced visualizations, install useful plugins, or integrate it with tools like Prometheus, MySQL, or Elasticsearch for a complete observability stack. You can also explore running other GUI-based applications in Docker to create a more interactive and flexible environment.

4.5 ★ | 2 Vote

May be interested