Grafana – Open Source Analytics and Monitoring Platform

4.8 Stars
Version 10.2
100 MB
Grafana – Open Source Analytics and Monitoring Platform

What is Grafana?

Grafana is a powerful open-source analytics and interactive visualization platform that enables users to query, visualize, alert on, and understand metrics no matter where they are stored. Developed by Grafana Labs, this platform has become the industry standard for observability dashboards, used by organizations worldwide to monitor infrastructure, applications, and business metrics.

Grafana supports over 50 data sources including Prometheus, InfluxDB, Elasticsearch, MySQL, PostgreSQL, and cloud platforms like AWS CloudWatch, Azure Monitor, and Google Cloud Monitoring. Its plugin architecture enables community extensions, continuously expanding supported data sources and visualization options.

From simple single-host monitoring to complex multi-cloud observability stacks, Grafana scales to meet diverse monitoring needs. Its rich visualization capabilities, alerting system, and collaboration features make it essential for DevOps teams, SREs, and anyone needing insight into system and application behavior.

Key Features and Capabilities

Data Source Integration

Grafana connects to virtually any data source through built-in integrations and plugins. Time series databases, SQL databases, cloud monitoring services, logging platforms, and custom APIs can all serve as data sources, enabling unified dashboards across diverse data stores.

Visualization Panels

Rich visualization options include time series graphs, stat panels, gauges, bar charts, heatmaps, histograms, tables, geomap displays, and more. Each panel type supports extensive customization of colors, thresholds, legends, and display options.

Dashboard Features

Dashboards organize panels into coherent views with variables for dynamic filtering, annotations for event correlation, and linking between dashboards. Templates enable dashboard reuse across different environments, hosts, or services.

Alerting

Grafana’s alerting system evaluates rules against data source queries, sending notifications through various channels including email, Slack, PagerDuty, OpsGenie, and webhooks. Alert rules support complex conditions, grouping, and silencing.

Explore Mode

The Explore interface provides an ad-hoc query environment for investigating metrics and logs. Split view enables comparing data across time ranges or data sources, facilitating incident investigation.

Provisioning

Infrastructure-as-code support enables version-controlled dashboard and data source configuration. YAML files define dashboards, data sources, and alert rules, enabling GitOps workflows and consistent deployments.

System Requirements

Minimum Requirements

Grafana requires minimal resources for small deployments: 1 CPU core, 512 MB RAM, and 500 MB disk space. Production deployments typically need 2-4 CPU cores and 4-8 GB RAM depending on the number of users and dashboard complexity.

Supported Platforms

Grafana runs on Linux (all major distributions), Windows Server 2012+, macOS 10.15+, and Docker. Most production deployments use Linux with systemd service management.

Installation Guide

Installing on Ubuntu/Debian

# Install prerequisites
sudo apt install -y apt-transport-https software-properties-common wget

# Add Grafana GPG key
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

# Add repository
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

# Install Grafana
sudo apt update
sudo apt install grafana

# Start and enable service
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

# Check status
sudo systemctl status grafana-server

# Access at http://localhost:3000
# Default credentials: admin / admin

Installing on RHEL/CentOS

# Add Grafana repository
sudo tee /etc/yum.repos.d/grafana.repo << 'EOF'
[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF

# Install Grafana
sudo dnf install grafana

# Start service
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Installing with Docker

# Run Grafana container
docker run -d \
  --name grafana \
  -p 3000:3000 \
  -v grafana-storage:/var/lib/grafana \
  grafana/grafana-oss

# With environment variables
docker run -d \
  --name grafana \
  -p 3000:3000 \
  -e "GF_SECURITY_ADMIN_PASSWORD=secret" \
  -e "GF_INSTALL_PLUGINS=grafana-clock-panel" \
  -v grafana-storage:/var/lib/grafana \
  grafana/grafana-oss

# Docker Compose
# docker-compose.yml
version: '3.8'
services:
  grafana:
    image: grafana/grafana-oss:latest
    ports:
      - "3000:3000"
    volumes:
      - grafana-data:/var/lib/grafana
      - ./provisioning:/etc/grafana/provisioning
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
    restart: unless-stopped

volumes:
  grafana-data:

Installing on Kubernetes

# Using Helm
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

# Install with default values
helm install grafana grafana/grafana

# Install with custom values
helm install grafana grafana/grafana \
  --set adminPassword='strongpassword' \
  --set persistence.enabled=true \
  --set persistence.size=10Gi

# Get admin password
kubectl get secret grafana -o jsonpath="{.data.admin-password}" | base64 --decode

Configuration

Configuration File

# /etc/grafana/grafana.ini

[server]
http_port = 3000
domain = grafana.example.com
root_url = https://grafana.example.com/

[database]
type = postgres
host = localhost:5432
name = grafana
user = grafana
password = secret

[security]
admin_user = admin
admin_password = secret
secret_key = your-secret-key
disable_gravatar = true

[users]
allow_sign_up = false
auto_assign_org = true
auto_assign_org_role = Viewer

[auth]
disable_login_form = false
oauth_auto_login = false

[auth.google]
enabled = true
client_id = your-client-id
client_secret = your-client-secret
allowed_domains = example.com

[smtp]
enabled = true
host = smtp.example.com:587
user = grafana@example.com
password = smtp-password
from_address = grafana@example.com

[alerting]
enabled = true
execute_alerts = true

[log]
mode = console file
level = info

[analytics]
reporting_enabled = false

Adding Data Sources

Prometheus Data Source

# Via UI: Configuration > Data Sources > Add data source > Prometheus
# URL: http://prometheus:9090

# Via provisioning: /etc/grafana/provisioning/datasources/prometheus.yml
apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://prometheus:9090
    isDefault: true
    jsonData:
      httpMethod: POST
      manageAlerts: true
      prometheusType: Prometheus
      prometheusVersion: "2.40.0"

InfluxDB Data Source

# Via provisioning
apiVersion: 1
datasources:
  - name: InfluxDB
    type: influxdb
    access: proxy
    url: http://influxdb:8086
    jsonData:
      version: Flux
      organization: myorg
      defaultBucket: mybucket
    secureJsonData:
      token: your-influxdb-token

MySQL/PostgreSQL Data Source

# Via provisioning
apiVersion: 1
datasources:
  - name: MySQL
    type: mysql
    url: mysql-host:3306
    database: mydb
    user: grafana
    secureJsonData:
      password: secret
    jsonData:
      maxOpenConns: 10
      maxIdleConns: 5

Creating Dashboards

Dashboard JSON Structure

{
  "dashboard": {
    "id": null,
    "uid": "my-dashboard",
    "title": "My Dashboard",
    "tags": ["production", "api"],
    "timezone": "browser",
    "refresh": "5s",
    "time": {
      "from": "now-1h",
      "to": "now"
    },
    "panels": [
      {
        "id": 1,
        "type": "timeseries",
        "title": "CPU Usage",
        "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
        "targets": [
          {
            "expr": "100 - (avg(irate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
            "legendFormat": "CPU %"
          }
        ],
        "fieldConfig": {
          "defaults": {
            "unit": "percent",
            "min": 0,
            "max": 100,
            "thresholds": {
              "mode": "absolute",
              "steps": [
                { "color": "green", "value": null },
                { "color": "yellow", "value": 70 },
                { "color": "red", "value": 90 }
              ]
            }
          }
        }
      }
    ],
    "templating": {
      "list": [
        {
          "name": "instance",
          "type": "query",
          "datasource": "Prometheus",
          "query": "label_values(node_cpu_seconds_total, instance)"
        }
      ]
    }
  }
}

Dashboard Provisioning

# /etc/grafana/provisioning/dashboards/default.yml
apiVersion: 1
providers:
  - name: 'default'
    orgId: 1
    folder: 'Infrastructure'
    type: file
    disableDeletion: false
    updateIntervalSeconds: 30
    options:
      path: /var/lib/grafana/dashboards

Common PromQL Queries for Dashboards

System Metrics

# CPU Usage
100 - (avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)

# Memory Usage
(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100

# Disk Usage
100 - ((node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100)

# Network Traffic
rate(node_network_receive_bytes_total[5m])
rate(node_network_transmit_bytes_total[5m])

# Load Average
node_load1
node_load5
node_load15

Application Metrics

# HTTP Request Rate
sum(rate(http_requests_total[5m])) by (status)

# Request Latency (95th percentile)
histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))

# Error Rate
sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) * 100

# Active Connections
sum(active_connections)

Alerting Configuration

Alert Rules

# Via provisioning: /etc/grafana/provisioning/alerting/rules.yml
apiVersion: 1
groups:
  - orgId: 1
    name: infrastructure
    folder: Infrastructure Alerts
    interval: 1m
    rules:
      - uid: high-cpu-alert
        title: High CPU Usage
        condition: C
        data:
          - refId: A
            relativeTimeRange:
              from: 600
              to: 0
            datasourceUid: prometheus
            model:
              expr: 100 - (avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
          - refId: C
            relativeTimeRange:
              from: 600
              to: 0
            datasourceUid: __expr__
            model:
              type: threshold
              expression: A
              conditions:
                - evaluator:
                    type: gt
                    params: [80]
        noDataState: NoData
        execErrState: Error
        for: 5m
        annotations:
          summary: CPU usage is above 80%
        labels:
          severity: warning

Contact Points

# /etc/grafana/provisioning/alerting/contact-points.yml
apiVersion: 1
contactPoints:
  - orgId: 1
    name: slack-notifications
    receivers:
      - uid: slack-receiver
        type: slack
        settings:
          url: https://hooks.slack.com/services/xxx
          recipient: "#alerts"
          text: |
            {{ range .Alerts }}
            *{{ .Status | toUpper }}*: {{ .Labels.alertname }}
            {{ .Annotations.summary }}
            {{ end }}

  - orgId: 1
    name: email-notifications
    receivers:
      - uid: email-receiver
        type: email
        settings:
          addresses: ops@example.com
          singleEmail: false

Variables and Templating

Variable Types

# Query variable (from data source)
label_values(node_cpu_seconds_total, instance)

# Custom variable
value1, value2, value3

# Interval variable
$__interval

# Using variables in queries
node_cpu_seconds_total{instance=~"$instance"}
rate(http_requests_total{service="$service"}[$interval])

Plugins

Plugin Management

# Install plugin via CLI
grafana-cli plugins install grafana-piechart-panel
grafana-cli plugins install grafana-worldmap-panel
grafana-cli plugins install grafana-clock-panel

# List installed plugins
grafana-cli plugins ls

# Update plugins
grafana-cli plugins update-all

# Remove plugin
grafana-cli plugins remove grafana-piechart-panel

# Install via environment variable (Docker)
GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-piechart-panel

Grafana CLI Commands

# Plugin management
grafana-cli plugins list-remote
grafana-cli plugins install 
grafana-cli plugins update 

# Admin commands
grafana-cli admin reset-admin-password newpassword
grafana-cli admin data-migration

# Configuration
grafana-cli admin settings

# Generate secret key
openssl rand -base64 32

Best Practices

Dashboard Design

1. Use consistent naming conventions
2. Group related panels logically
3. Set appropriate time ranges and refresh intervals
4. Use variables for filtering
5. Include documentation in dashboard description
6. Use meaningful panel titles and descriptions
7. Configure appropriate thresholds for visual feedback
8. Keep dashboards focused on specific topics

Performance Optimization

1. Use query caching when available
2. Limit time ranges in queries
3. Use appropriate aggregation functions
4. Avoid too many panels per dashboard
5. Use recording rules in Prometheus for complex queries
6. Configure appropriate refresh intervals

Conclusion

Grafana provides a comprehensive platform for visualizing and understanding data from virtually any source. Its flexibility in data source integration, rich visualization options, and powerful alerting capabilities make it indispensable for modern observability practices.

Whether monitoring infrastructure health, tracking application performance, or visualizing business metrics, Grafana delivers the tools needed to transform data into actionable insights.

Developer: Grafana Labs

Download Options

Download Grafana – Open Source Analytics and Monitoring Platform

Version 10.2

File Size: 100 MB

Download Now
Safe & Secure

Verified and scanned for viruses

Regular Updates

Always get the latest version

24/7 Support

Help available when you need it