Grafana Data Sources

A data source is the external system where your data lives. Grafana reads from that system and draws the data as charts. Without at least one data source, Grafana has nothing to display. This topic explains what data sources are, which ones Grafana supports, and how to add your first one.

The Restaurant Analogy

Think of Grafana as a restaurant chef. The chef does not grow vegetables or raise livestock — the chef orders ingredients from suppliers. Data sources are those suppliers. Grafana orders data from a database or monitoring tool and turns it into a beautiful visual dish (your dashboard).

Data Source (Supplier)       Grafana (Chef)        Dashboard (Dish)
┌──────────────┐            ┌──────────────┐       ┌──────────────┐
│  Prometheus  │──── data ──│   Grafana    │──────▶│  Line Chart  │
│  (metrics)   │            │  (queries &  │       │  Bar Chart   │
└──────────────┘            │  visualizes) │       │  Table       │
┌──────────────┐            └──────────────┘       └──────────────┘
│  MySQL       │──── data ──┘
│  (records)   │
└──────────────┘

Built-in Data Sources

Grafana ships with built-in support for the most popular data systems. You do not need to install anything extra to use these.

Prometheus

Prometheus is the most widely used data source with Grafana. It stores time-series metrics — numbers that change over time — such as CPU usage and request rates. DevOps teams pair Prometheus with Grafana as their standard monitoring stack.

Loki

Loki stores log lines (text messages from your applications). With Grafana and Loki together, you see both metric charts and application logs on the same dashboard.

MySQL and PostgreSQL

These are classic relational databases. Grafana queries them with standard SQL and turns the result sets into tables or charts. This works well for business data like sales figures and user registrations.

InfluxDB

InfluxDB is a database built specifically for time-series data. It is popular for IoT sensor data and network performance monitoring.

Elasticsearch and OpenSearch

These tools store and search large volumes of log and event data. Grafana queries them and displays results as histograms, log tables, and metric graphs.

Graphite

Graphite is an older time-series database still used in many organisations. Grafana has supported it since its earliest versions.

Azure Monitor, CloudWatch, Google Cloud Monitoring

Grafana connects directly to cloud provider monitoring APIs. Teams that run on AWS, Azure, or Google Cloud pull their cloud metrics straight into Grafana dashboards.

Tempo

Tempo stores distributed traces — records of exactly how a user request travelled through multiple microservices. Linking Tempo with Grafana gives you full observability: metrics, logs, and traces in one place.

How to Add a Data Source

Adding a data source takes less than two minutes. The process is the same regardless of which data source you choose.

Step 1 – Open Connections

In the left sidebar, click ConnectionsData Sources. A page lists all currently configured data sources.

Step 2 – Click Add Data Source

Click the Add data source button in the top right. A search page displays all available data source types.

Step 3 – Choose a Type

Type the name of your data source (for example, "Prometheus") in the search box and click on it.

Step 4 – Fill in the Connection Details

Each data source has a configuration form. For Prometheus, you enter the URL where Prometheus runs. For MySQL, you enter the host, port, database name, username, and password.

Example Prometheus Configuration:
──────────────────────────────────
Name:  My Prometheus
URL:   http://localhost:9090
Access: Server (default)
──────────────────────────────────

Step 5 – Save and Test

Click Save & Test. Grafana immediately sends a test request to the data source. A green success message confirms the connection works. A red error message shows what went wrong — usually a wrong URL or incorrect credentials.

Multiple Data Sources on One Dashboard

Grafana allows each panel on a dashboard to use a different data source. Panel A can pull CPU data from Prometheus while Panel B pulls sales records from MySQL. You simply select the data source from the dropdown inside each panel's query editor.

Dashboard
├── Panel A → Prometheus (CPU usage graph)
├── Panel B → MySQL (daily sales table)
└── Panel C → Loki (application error logs)

Default Data Source

When you add multiple data sources, you can mark one as the default. New panels automatically use the default data source unless you change it manually. Set the default by opening the data source settings and toggling the Default switch to on.

Data Source Permissions

In Grafana Enterprise, you can restrict which teams or users access each data source. In Grafana OSS, all logged-in users with the Editor or Admin role can use all data sources. Viewers can only see the results, not edit queries.

Leave a Comment

Your email address will not be published. Required fields are marked *