Grafana Tutorial

Grafana Tutorial For Beginners

April 4th, 2026
13709
4:00 Minutes

Grafana is the de facto open-source standard for observability that helps teams identify and tackle performance issues through powerful tools for analyzing and monitoring databases, infrastructure and machine learning models. It unifies the three pillars of observability metrics, logs, and traces into a single, intuitive interface. This Grafana tutorial begins with an answer to 'what is Grafana' and covers its installation process, configuration, creation of a production-ready dashboard, and key queries for today's most popular data sources.

What Is Grafana?

Grafana is an open-source analytics and interactive visualization platform that allows you to query, visualize, alert on, and understand your data no matter where it’s stored. At its core, Grafana enables you to create dynamic and reusable dashboards with panels, each representing a specific metric or log query over time.

It connects with a myriad of data sources, including time-series databases like Prometheus, InfluxDB, and Graphite; log aggregators like Loki and Elasticsearch; and traditional SQL databases like PostgreSQL and MySQL. Its extensible plugin architecture allows the community and enterprises to integrate with virtually any data source.

Its most common use case is visualizing time-series data, such as server CPU and memory usage, application request latency, or error rates. It's an essential tool for DevOps, Site Reliability Engineering (SRE), and development teams to track application behavior, monitor infrastructure health, and receive alerts on anomalies before they impact users. Its vibrant community of enthusiasts shares reusable dashboards and plugins, which is one of its biggest strengths.

Grafana vs. Kibana vs. Tableau: A Quick Comparison

Here is a comparison table outlining the key differences between Grafana, Kibana, and Tableau.

Feature Grafana Kibana Tableau
Primary Use Case Real-time Monitoring & Observability. Ideal for time-series data like server metrics, application performance, and IoT sensor data. Log Analysis & Exploration. Designed to search, analyze, and visualize data stored in Elasticsearch. Part of the ELK Stack. Business Intelligence (BI) & Analytics. Built for deep data exploration, creating interactive reports, and data storytelling for business insights.
Typical User DevOps Engineers, SREs, Developers, IT Operations. Security Analysts, Developers, System Administrators. Business Analysts, Data Scientists, Executives, Marketing & Sales Teams.
Data Sources Extremely Versatile. Connects to a wide range of data sources like Prometheus, InfluxDB, MySQL, PostgreSQL, Elasticsearch, and cloud monitoring services (AWS, Azure, GCP). Primarily Elasticsearch. Tightly integrated with and optimized for data within the Elasticsearch ecosystem. Very Broad Connectivity. Connects to hundreds of sources, including databases, spreadsheets (Excel, Google Sheets), cloud data warehouses (Snowflake, BigQuery), and business apps (Salesforce).
Visualization Focus Excellent for time-series charts, graphs, and operational dashboards. Visualizations are geared towards monitoring changes over time. Strong in visualizing log data with charts, tables, and maps. Features like Canvas allow for creating infographic-style, live data presentations. Highly polished and interactive visualizations. Focuses on data storytelling with a vast library of charts, maps, and formatting options for executive-ready reports.
Ease of Use Requires some technical knowledge, especially for query languages (e.g., PromQL). Steeper learning curve for non-technical users. User-friendly interface for searching and filtering. Setting up the full ELK stack can be complex. Very user-friendly. Its drag-and-drop interface is designed for users with little to no technical background.
Pricing Model Open-source and free. Offers a paid, fully managed Grafana Cloud service and an Enterprise version with advanced features and support. Open-source and free (the "Basic" tier). Advanced features (e.g., machine learning, security) are available in paid Elastic Stack tiers. Commercial product. Pricing is per-user, with different tiers for creators, explorers, and viewers. Can be expensive at scale.
Alerting Core Feature. Has a robust, built-in alerting system that can send notifications through various channels like Slack, PagerDuty, and email. Included in Paid Tiers. Advanced alerting and anomaly detection are part of the paid Elastic Stack subscriptions. Available but with a different focus. "Data-driven alerts" can notify users when data crosses a certain threshold, but it's less focused on operational monitoring.

Which Tool Should You Choose? A Quick Guide

  • Choose Grafana for real-time operational intelligence. If you need to monitor the health of your infrastructure, applications, or network and get immediate alerts on performance issues, Grafana is the industry standard.
  • Choose Kibana when your ecosystem is built around Elasticsearch. It is unmatched for deep-diving into log data, security event analysis (SIEM), and exploring any data stored within the ELK Stack.
  • Choose Tableau for business intelligence and data storytelling. When your goal is to analyze sales trends, customer behavior, or financial data to make strategic business decisions, Tableau's polished reports and dashboards are superior.

How to Install Grafana (Version 10.x and Later)

While Grafana can be installed on various operating systems, the most flexible and widely used method is running it via Docker. This ensures a consistent environment and simplifies upgrades.

Method 1: Install Grafana Using Docker (Recommended)

This approach is ideal for developers and enterprises wanting a quick, isolated setup without modifying the local machine.

Prerequisites

  • Docker is installed on your system (Windows, macOS, or Linux).
  • A stable internet connection.

Steps to Run Grafana with Docker

Step 1. Open your terminal or PowerShell.

Step 2. Run the following command. This will download the latest open-source version of Grafana, start it, and create a persistent volume (`grafana-storage`) to save your dashboards and configurations.

docker run -d \
  -p 3000:3000 \
  --name=grafana \
  -v grafana-storage:/var/lib/grafana \
  grafana/grafana-oss

Step 3. Once the container is running, open your web browser and navigate to http://localhost:3000.

Step 4. Log in with the default credentials:

  • Username: `admin`
  • Password: `admin`

You will be prompted to change your password immediately after your first login for security.

Method 2: Install Grafana Locally on Windows

For those who prefer a traditional installation, you can use the Windows installer.

Prerequisites

  • You have strong internet connectivity.
  • Your Windows machine has administrative privileges.
  • Download the compatible installer package for your system's architecture (64-bit is standard).

Step-by-Step Guide to Installing on Windows

  1. Visit the official Grafana download page and download the latest Windows installer.
  2. Run the downloaded installer executable. The setup wizard will launch.
  3. Accept the license agreement and click Next.
  4. Choose the destination folder for the installation and click Next.
  5. Review the installation summary and click Install to begin the process.
  6. Once the installation is complete, a confirmation message will appear. Click Finish.
  7. Grafana is installed as a Windows service and will start automatically. To access it, open your browser and navigate to http://localhost:3000/.
  8. Log in using the default credentials (`admin`/`admin`) and change your password when prompted.

Practical Grafana Queries for Key Data Sources

The power of Grafana lies in its query editor. The syntax depends entirely on your configured data source. Here are some practical, real-world examples for the most common data sources.

1. Prometheus (PromQL)

Prometheus is the most popular data source for monitoring infrastructure and services.

  • CPU Usage Percentage per Core: This query calculates the non-idle CPU time over the last 5 minutes, averaged by CPU core.
    (1 - avg by (cpu) (rate(node_cpu_seconds_total{mode="idle"}[5m])))  100
  • Memory Usage Percentage: Calculates the percentage of total memory currently in use.
    (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes))  100

2. Loki (LogQL)

Loki is Grafana's log aggregation system, designed to be cost-effective and easy to operate.

  • Count of Application Errors: This query finds all log lines from the `webapp` job containing the word "error" and calculates the rate per minute.
    sum(rate({job="webapp"} |= "error" [1m]))

3. SQL (PostgreSQL/MySQL)

Grafana can query any SQL database and visualize the results, especially time-series data.

  • Time-Series Data from a SQL Table: This query selects data from an `events` table, using Grafana's built-in macros to handle the time range selected in the dashboard.
    SELECT
      $__timeGroupAlias(time_column, $__interval),
      avg(value_column) as "Average Value"
    FROM
      your_table
    WHERE
      $__timeFilter(time_column)
    GROUP BY 1
    ORDER BY 1

    Note: `$__timeFilter` and `$__timeGroupAlias` are powerful Grafana macros that inject the correct SQL code based on the user's selected time range and the panel's resolution.

From Zero to Dashboard: A Practical Walkthrough

Let's create our first useful dashboard panel. This guide assumes you have configured a Prometheus data source that is scraping metrics from a server.

  1. Create a New Dashboard: In the left-side menu, click on the Dashboards icon and then click New Dashboard.
  2. Add a Visualization: Click on the + Add visualization button.
  3. Select Your Data Source: In the panel editor, select your Prometheus data source from the dropdown menu.
  4. Write Your Query: In the query editor's "Metrics browser" input, enter the PromQL query to calculate CPU usage:
    (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m]))) 100
  5. Run the Query: Grafana will automatically run the query and display a time-series graph. You should see lines representing the CPU usage for each monitored instance.
  6. Customize the Panel: On the right-hand side, you can customize the panel:
    • Panel title: Set it to "CPU Usage (%)".
    • Unit: Under "Standard options," find "Unit" and select "Percent (0-100)". This will format the Y-axis correctly.
    • Thresholds: Go to the "Thresholds" section to set color indicators. For example, set a base color of green, and add thresholds for `80` (yellow) and `90` (red). Your graph will now change color when usage is high.
  7. Save the Panel and Dashboard: Click Apply in the top right to save the panel configuration. Then, click the Save dashboard icon (a floppy disk) in the top header. Give your dashboard a name (e.g., "Server Monitoring") and click Save.

You have now created your first dynamic and visually intuitive monitoring panel!

Grafana for the Enterprise: Scaling and Security

While Grafana is easy to start with, it also includes powerful features required for large-scale enterprise deployments.

1. Unified Alerting

Grafana’s built-in alerting system is a core feature. You can create alert rules directly from your dashboard panels. When a query returns data that crosses a defined threshold (e.g., CPU usage above 90% for 5 minutes), Grafana triggers an alert.

  • Notification Channels: Alerts are sent via Notification Channels, which can be configured for services like Slack, PagerDuty, email, Microsoft Teams, and webhooks.
  • Multi-dimensional Alerting: Alert rules can generate a unique alert for each series that violates the condition (e.g., one alert for `server-A` and another for `server-B`), preventing alert noise.

2. Security and Permissions

In an enterprise setting, controlling access to data is critical. Grafana provides robust access control:

  • Authentication: Integrates with external authentication providers like LDAP, SAML, OAuth (Google, GitHub, Okta), and more.
  • Teams and Permissions: You can group users into Teams and assign permissions to specific dashboards, folders, or data sources. This ensures that a development team can only see their own application dashboards, while the SRE team has global access.

3. The Grafana Enterprise Stack

For organizations with mission-critical requirements, Grafana offers commercial products:

  • Grafana Enterprise: A self-hosted version that includes enterprise-grade features like advanced authentication, reporting, auditing, and enterprise-only plugins for data sources like Splunk, ServiceNow, and Oracle.
  • Grafana Cloud: A fully managed, highly available, and scalable observability platform hosted by Grafana Labs. It includes a generous free-forever tier and scales to handle metrics, logs, and traces for even the largest organizations.

Key Grafana Terminologies to Know in 2026

To effectively use Grafana, one must understand its core terminologies. These concepts help you create powerful dashboards, visualizations, and alerts.

1. Time Series Data

A sequence of data points indexed in time order. This is the primary type of data Grafana is designed to visualize, perfect for tracking changes in metrics like CPU usage, temperature, or stock prices over time.

2. Data Source

A data source is any storage backend where your data lives. Grafana connects to these backends (e.g., Prometheus, PostgreSQL, Loki) to fetch the data for visualization. Each data source has its own specific query language.

3. Dashboard

A dashboard is a collection of one or more panels organized in a grid. A typical dashboard provides a high-level overview of a system, service, or business process.

4. Panel

A panel is the basic building block of a dashboard. Each panel displays data using a specific visualization type (like a graph, single stat, table, or heatmap) and is powered by a query to a data source.

5. Plugin

Plugins extend Grafana’s functionality. There are three types: Data Source Plugins (to connect to new databases), Panel Plugins (for new visualization types), and App Plugins (which bundle data sources, panels, and dashboards for a complete experience, like the Kubernetes or Zabbix apps).

6. Alert Rule

A set of conditions that, when met, trigger an alert. An alert rule is defined by one or more queries and a condition (e.g., `WHEN avg() OF query(A) IS ABOVE 90`).

7. Variables (Templating)

Variables allow you to create highly interactive and reusable dashboards. For instance, instead of hardcoding a server name in your queries, you can create a `server` variable that appears as a dropdown menu at the top of the dashboard. Selecting a server from the menu updates all the panels automatically.

Wrapping Up 'Grafana Tutorial'

Grafana is an essential tool in the modern tech stack, not just for reacting to performance issues but for proactively monitoring systems with intelligent alerts. This Grafana tutorial covered the fundamentals, from what Grafana is to installing it, writing practical queries, and building your first dashboard. By leveraging its powerful features, teams can gain deep insights into their systems, reduce downtime, and drive operational excellence.

FAQs for 'Grafana Tutorial'

Q1. What is the difference between Grafana Open Source and Grafana Cloud?

Grafana Open Source (OSS) is the free, self-hosted version you install and manage on your own servers. It's incredibly powerful and sufficient for many use cases. Grafana Cloud is a fully managed, SaaS platform from Grafana Labs. It handles the hosting, scaling, and maintenance for you and offers a generous free-forever tier, making it the easiest way to get started. Paid tiers offer more data retention, users, and enterprise features.

Q2. Can Grafana be used for business intelligence (BI)?

While Grafana's primary focus is on time-series data and operational monitoring, it can be used for some BI tasks, especially when querying SQL databases. You can create tables, bar charts, and graphs to track business KPIs. However, for deep, exploratory data analysis and creating highly polished business reports, dedicated BI tools like Tableau or Power BI are generally more suitable.

Q3. How does Grafana handle large-scale data and high availability?

Grafana itself is stateless and lightweight; it primarily queries data sources rather than storing data. For high availability, you can run multiple Grafana instances behind a load balancer, all connected to a shared database (like PostgreSQL) for dashboard storage. The performance and scalability depend almost entirely on the underlying data source's ability to handle query load.

Q4. What programming language is Grafana written in?

Grafana's backend is written primarily in Go, which makes it highly performant and cross-platform. The frontend is built using modern web technologies, primarily React and TypeScript.

About the Author
Author Nehal Sharma
About the Author

Nehal Sharma is a skilled content writer with expertise in Java, mobile development, and data analytics. She transforms complex data into actionable insights and has experience in business intelligence, data science, and Salesforce. She also simplifies technical concepts into clear, engaging content for learners and professionals.

Drop Us a Query
Fields marked * are mandatory
×

Your Shopping Cart


Your shopping cart is empty.