Catalog / Grafana Cheatsheet

Grafana Cheatsheet

A comprehensive cheat sheet covering essential Grafana concepts, configurations, and best practices for effective monitoring and visualization.

Core Concepts & Navigation

Key Terminology

Dashboard

A collection of panels arranged for a specific monitoring purpose.

Panel

A single visualization displaying data from a specific data source.

Data Source

A connection to a database or service providing the data for visualization (e.g., Prometheus, InfluxDB).

Query

A request for specific data from a data source, defined using the data source’s query language.

Variable

A dynamic value used in queries and panel titles to allow for flexible dashboards.

Alert

A notification triggered when data meets predefined conditions.

Navigation Shortcuts

d

Open dashboard search.

/

Focus the Grafana search bar.

Esc

Close modals and dropdowns.

v

Toggle the variables.

.

Quick date range.

?

Show all shortcuts.

Data Sources & Querying

Common Data Sources

  • Prometheus: Time series database, popular for monitoring.
  • InfluxDB: Time series database, suitable for metrics and events.
  • Elasticsearch: Search and analytics engine, useful for logs and events.
  • Graphite: Time series database with a focus on graphing.
  • MySQL/PostgreSQL: Relational databases, can be used for storing metrics.

PromQL Essentials (Prometheus)

metric_name

Selects all time series with the given metric name.

metric_name{label="value"}

Filters by label value.

rate(metric_name[5m])

Calculates the per-second rate of increase over a 5-minute window.

sum(metric_name)

Aggregates the sum of all time series.

avg_over_time(metric_name[1h])

Calculates the average value over a 1-hour window.

increase(metric_name[1m])

Calculates the increase in the time series over the specified time range. The returned results is added to the last value.

InfluxQL Essentials (InfluxDB)

SELECT field FROM measurement

Selects all values of the specified field from the measurement.

SELECT field FROM measurement WHERE tag = 'value'

Filters by tag value.

SELECT MEAN(field) FROM measurement GROUP BY time(5m)

Calculates the mean of the field grouped into 5-minute intervals.

SELECT SUM(field) FROM measurement

Calculates the sum of the field.

SELECT MAX(field) FROM measurement

Calculates the max of the field.

Panel Types & Customization

Common Panel Types

  • Time series: Standard line graphs for visualizing time-based data.
  • Bar chart: Useful for comparing discrete values or showing distributions.
  • Gauge: Displays a single value as a percentage of a threshold.
  • Stat: Shows a single, summarized value with optional thresholds and colors.
  • Table: Presents data in a tabular format.
  • Text: Displays static or dynamic text, often used for annotations or explanations.

Panel Options

Title

Sets the panel title.

Description

Add a descriptive text to the panel.

Time range

Overrides the dashboard time range for a specific panel.

Axes

Configures the Y-axis labels, units, and scaling.

Legend

Customize the legend display (e.g., placement, visibility).

Thresholds

Sets thresholds for alerting and visual highlighting.

Customizing Visualizations

Grafana provides various options to customize the look and feel of panels.
You can adjust colors, line styles, fill opacity, and more. These settings are found in the ‘Style’ and ‘Display’ tabs of the panel editor.

You can use overrides to configure each panel individually, or use the Dashboard JSON model to make changes programmatically.

Alerting & Notifications

Alerting Rules

Evaluation interval

How often the rule is evaluated.

Conditions

The conditions that must be met for the alert to trigger (e.g., value above threshold).

Notifications

The notification channels to send alerts to (e.g., email, Slack, PagerDuty).

For

How long the condition must be met before the alert is triggered.

Annotations

Add notes about the alert. It is possible to add variables to the annotations.

Notification Channels

Grafana supports a variety of notification channels, including Email, Slack, PagerDuty, Webhooks, and more.
Configure notification channels under ‘Alerting’ -> ‘Notification channels’ in the Grafana settings.

When configuring webhooks, take into account security issues.

Alert States

OK

The alert is not active and the condition is not met.

Pending

The alert condition has been met, but the ‘For’ duration has not yet elapsed.

Firing

The alert is active and notifications are being sent.

No Data

The alert is active but the query returns no data. Check the query to make sure that it returns data in the selected time period.