Tools / Grafana Interview questions
Last updated
1. What is Grafana?
Grafana is an open-source observability and data visualization platform. You point it at one or more data sources, write queries, and turn the results into dashboards, explorations and alerts.
Grafana does not store your metrics itself. It queries the systems that do, such as Prometheus, Loki, InfluxDB or a SQL database, and renders what comes back. The backend is written in Go and the UI in TypeScript and React.
Teams use it mostly for infrastructure and application monitoring, but the same dashboards also work for business KPIs, IoT data and CI/CD metrics.
Take quiz
From a built-in time-series engine that replaces Prometheus
From log files it scrapes directly off the browser
From external data sources that it queries, such as Prometheus or Loki
Java on the backend, Angular on the frontend
Go on the backend, TypeScript/React on the frontend
Python on the backend, Vue on the frontend
2. What are the main features of Grafana?
Grafana bundles several tools around one idea: query data from anywhere and make it useful. The ones interviewers usually expect you to name:
- Dashboards built from panels on a shared time range
- Explore for ad hoc queries without saving a dashboard
- Alerting with rules, contact points and notification policies
- Template variables for reusable dashboards
- Annotations to mark deployments and incidents on graphs
- Transformations to reshape query results
- Plugins for panels, data sources and apps
- Provisioning and RBAC for running it at scale
Take quiz
Template variables
Annotations
Transformations
Explore
Library panels
Playlists
Folders
3. Which data sources does Grafana support?
Grafana ships with built-in support for dozens of data sources, and plugins extend that list further. Each one has its own query editor.
| Category | Examples |
| Metrics | Prometheus, Mimir, Graphite, InfluxDB |
| Logs | Loki, Elasticsearch, OpenSearch |
| Traces | Tempo, Jaeger, Zipkin |
| SQL databases | PostgreSQL, MySQL, Microsoft SQL Server |
| Cloud monitoring | CloudWatch, Azure Monitor, Google Cloud Monitoring |
You can also combine several of them in a single panel using the Mixed data source.
Take quiz
Graphite
MySQL
Tempo
Zipkin
InfluxDB
Loki
Graphite
4. What is a Grafana dashboard?
A dashboard is a set of panels arranged on a grid, sharing a time range, refresh interval and optional variables. It is the main way people look at data in Grafana.
Under the hood a dashboard is just a JSON document stored in the Grafana database. It describes each panel, its queries, layout, variables and settings, which is why dashboards are easy to export, version in Git and provision.
Dashboards live inside folders, and rows can group and collapse related panels.
Take quiz
As a JSON document describing panels, queries and settings
As a compiled plugin binary
As a CSV of the last query results
The same visualization type
The dashboard time range
The same data source
5. What is a panel in Grafana?
A panel is the basic visual building block of a dashboard. Each panel holds one or more queries, optional transformations, a visualization type, and display settings.
Display settings, called field options, cover units, decimals, thresholds, value mappings, colors and overrides for specific series. A panel can also carry data links and alert-related context.
You build panels in the panel editor, which shows a live preview as you tweak queries and options.
Take quiz
Exactly one query and no display settings
One or more queries plus transformations and display options
Only a static image upload
In the panel's field options
In the data source's TLS settings
Only in the grafana.ini file
6. What are the common panel types in Grafana?
Choosing the right panel matters more than people think. These are the types that come up most often:
| Panel | Best for |
| Time series | Trends of metrics over time |
| Stat | One big headline number, like current error rate |
| Gauge / Bar gauge | A value measured against thresholds |
| Table | Raw or aggregated rows and columns |
| Heatmap | Distribution over time, such as latency buckets |
| Logs | Streaming and searching log lines |
| Geomap | Data on a map |
| State timeline | Status changes over time, like up/down |
Take quiz
Heatmap
Stat
Pie chart
Logs
Heatmap
Geomap
Stat
7. What is the default port and login for Grafana?
Grafana listens on port 3000. A fresh install has the username admin and password admin, and the UI asks you to change the password on first login.
For automated installs, set the admin password with an environment variable instead. This Docker example starts Grafana with a custom admin password:
docker run -d -p 3000:3000 \ -e GF_SECURITY_ADMIN_PASSWORD=S3cretPass \ grafana/grafana
Take quiz
9090
3000
8080
GRAFANA_ROOT_PASSWORD
GF_AUTH_ADMIN_KEY
GF_SECURITY_ADMIN_PASSWORD
GF_SERVER_ADMIN_PASS
8. What is the Grafana configuration file?
Grafana is configured through an INI-style file called grafana.ini. On Linux package installs it lives at /etc/grafana/grafana.ini. Defaults come from defaults.ini, so you only override what you need.
Settings are grouped in sections such as [server], [database], [security] and [auth]. Any setting can also be overridden with an environment variable named GF_<SECTION>_<KEY>, and environment variables win over the file.
[server] http_port = 3000 # same thing as an environment variable: # GF_SERVER_HTTP_PORT=3000
Restart Grafana after changing the file.
Take quiz
GF_HTTP_PORT_SERVER
GF_SERVER_HTTP_PORT
GRAFANA_SERVER_PORT
The grafana.ini value
The environment variable
The value in the dashboard JSON
9. What are template variables in Grafana?
Template variables are dropdowns at the top of a dashboard that get substituted into queries. Instead of hard-coding a server name, you write $instance and let the viewer pick.
The common types are Query (options come from a data source), Custom (a fixed list), Interval, Data source, Text box, Constant and Ad hoc filters. A variable can allow multiple selections or an All option.
# Query variable definition for Prometheus label_values(up, instance) # used in a panel query rate(node_cpu_seconds_total{instance=~"$instance"}[5m])
Take quiz
Constant
Text box
Query
They encrypt dashboard queries
They make Grafana start faster
One dashboard can serve many servers, clusters or namespaces
10. What is Grafana Explore?
Explore is a query workspace for ad hoc investigation. You pick a data source, run queries, and see results without creating or saving a dashboard.
It is built for troubleshooting. You can open a split view to compare two queries or two data sources side by side, for example metrics on the left and logs for the same time range on the right. Query history lets you re-run earlier queries, and any query can be added to a dashboard once it looks right.
Take quiz
Managing user permissions
Ad hoc querying and troubleshooting without saving a dashboard
Installing plugins
Running Grafana on two ports
Comparing two queries or data sources side by side
Exporting a dashboard to PDF
11. What are annotations in Grafana?
Annotations are markers drawn on time series graphs that tie an event to a point in time, such as a deployment, a config change or an incident.
You can add them manually by Ctrl/Cmd-clicking a graph, pull them from a data source with an annotation query, or create them through the HTTP API from a CI pipeline. The built-in Annotations & Alerts query also shows alert state changes.
When a metric jumps, seeing a deployment marker at the same moment often answers the question immediately.
Take quiz
Changing a panel's units
Marking a deployment on a graph
Creating a new user
By editing defaults.ini
Through the Grafana HTTP API
Only by clicking on the graph
12. What are the types of plugins in Grafana?
Grafana supports three plugin types. Each extends a different part of the product.
| Type | What it adds | Example |
| Panel | A new visualization | Clock panel, Treemap |
| Data source | A connection to a new backend | MongoDB, Splunk |
| App | A bundle of pages, panels and data sources | Kubernetes monitoring, OnCall |
Plugins are signed by Grafana Labs or the community. Unsigned plugins are blocked unless you list them in allow_loading_unsigned_plugins.
Take quiz
Panel plugin
Data source plugin
App plugin
The browser cache
Grafana's plugin signature check
The Prometheus scrape config
13. What are the different editions of Grafana?
Grafana comes in three flavors. They share the same core, so dashboards move between them easily.
| Edition | How it runs | Notes |
| OSS | Self-hosted, open source | Free, you manage upgrades and scaling |
| Enterprise | Self-hosted, licensed | Adds fine-grained RBAC, reporting, enterprise data source plugins, audit logs |
| Grafana Cloud | Managed by Grafana Labs | Hosted Grafana plus managed Mimir, Loki and Tempo, with a free tier |
Take quiz
Grafana Cloud
Grafana OSS
Grafana Enterprise self-hosted
Fine-grained RBAC and reporting
Template variables
The Prometheus data source
The time series panel
14. What is Grafana Loki?
Loki is Grafana's log aggregation system, often described as Prometheus for logs. Instead of indexing the full text of every line, it indexes only a small set of labels per log stream and stores compressed chunks in cheap object storage.
That design keeps storage and indexing costs low. You query with LogQL, which selects streams by label and then filters or parses the lines.
{app="checkout", env="prod"} |= "error" | json | level="error"
Logs reach Loki through an agent such as Grafana Alloy.
Take quiz
The full text of every log line
Only the timestamps
Only labels for each log stream
PromQL
LogQL
TraceQL
Flux
15. What is Grafana Tempo?
Tempo is a distributed tracing backend. It stores traces in object storage and, unlike older tracing systems, does not need a heavy index. You mostly find traces by trace ID, usually jumping from a log line or a metric exemplar.
It ingests common protocols, including OpenTelemetry (OTLP), Jaeger and Zipkin. For searching by attributes there is TraceQL, for example finding slow spans in one service.
{ resource.service.name = "checkout" && duration > 500ms }
Take quiz
LogQL
PromQL
TraceQL
By scraping an HTTP endpoint every 15 seconds
By trace ID, often linked from logs or exemplars
By running SQL joins over a relational schema
16. What is the LGTM stack?
LGTM is Grafana Labs' open-source observability stack. Each letter is one component and one signal type.
| Letter | Component | Signal |
| L | Loki | Logs |
| G | Grafana | Visualization and alerting |
| T | Tempo | Traces |
| M | Mimir | Metrics (scalable, long-term Prometheus storage) |
Together they let you go from a metric spike to the related logs and traces inside one UI.
Take quiz
Mimir
Metrics Gateway
Mixed
Loki
Mimir
Grafana
Tempo
17. What is Grafana Alloy?
Alloy is Grafana's distribution of the OpenTelemetry Collector. It collects metrics, logs, traces and profiles and forwards them to Prometheus, Mimir, Loki, Tempo or any OTLP backend. It replaces Grafana Agent and Promtail.
It is configured with components wired together in Alloy's own syntax. This one scrapes an app and writes the metrics to Mimir:
prometheus.scrape "app" { targets = [{"__address__" = "localhost:8080"}] forward_to = [prometheus.remote_write.mimir.receiver] } prometheus.remote_write "mimir" { endpoint { url = "http://mimir:9009/api/v1/push" } }
Take quiz
A dashboard JSON validator
A SQL query builder
An OpenTelemetry Collector distribution for collecting telemetry
Grafana Agent and Promtail
Prometheus Alertmanager
Jaeger UI
18. How do you share a Grafana dashboard?
There are several options depending on who needs access and how live the data should be.
- Share link: a URL that keeps the time range and variable values; viewers still need access
- Snapshot: a static copy with the data embedded, so no data source access is required
- Public dashboard: read-only access without logging in
- Export JSON: move the dashboard to another instance or Git
- Embed: iframe, which needs
allow_embedding = true - Reports: scheduled PDFs in Enterprise and Cloud
Take quiz
Share link
Snapshot
Export JSON
serve_from_sub_path = true
enable_gzip = true
allow_embedding = true
19. What are the user roles in Grafana?
Access in Grafana is organization-based, with three basic roles per org plus an instance-wide admin flag.
| Role | Can do |
| Viewer | View dashboards and use them, but not change them |
| Editor | Create and edit dashboards, folders and alert rules |
| Admin | Everything an Editor can, plus manage data sources, users and org settings |
| Grafana server admin | Instance-wide: manage organizations and all users |
Folder and dashboard permissions, and teams, refine these roles further.
Take quiz
Viewer
Editor
Admin
Create new folders
View dashboards without editing them
Manage organizations
20. What is the Grafana dashboard JSON model?
The JSON model is the full definition of a dashboard. You can see it under Dashboard settings, copy it, and import it elsewhere.
Key fields are uid (a stable identifier used in URLs and provisioning), title, panels, templating, time, annotations, and schemaVersion. The numeric id is internal and should be set to null when importing.
{ "uid": "node-overview", "title": "Node overview", "time": { "from": "now-6h", "to": "now" }, "templating": { "list": [] }, "panels": [] }
Take quiz
uid
id
schemaVersion
In the dashboard settings
In the plugin catalog
In the Alertmanager UI
21. How do you add a data source in Grafana?
From the UI, open Connections > Data sources, click Add new data source, and choose a type. Then enter the connection details and press Save & test.
- Pick the data source type, for example Prometheus
- Enter the URL, such as
http://prometheus:9090 - Set authentication or TLS options if needed
- Click Save & test and confirm the green success message
Admin rights are required. For repeatable setups, define data sources in a provisioning YAML file instead.
Take quiz
The Save & test check
Restarting the Grafana server
Importing a dashboard
Viewer
Admin
Anonymous
22. How do you install a plugin in Grafana?
The simplest way is the Grafana CLI, followed by a restart. Plugins land in /var/lib/grafana/plugins on Linux.
grafana cli plugins install grafana-clock-panel sudo systemctl restart grafana-server
In containers, pass plugin IDs through GF_INSTALL_PLUGINS. You can also browse and install from Administration > Plugins in the UI. Unsigned plugins need to be allowed explicitly in the config.
Take quiz
grafana plugins push <plugin-id>
grafana cli plugins install <plugin-id>
grafana-server --add-plugin <plugin-id>
GF_PLUGINS_DOWNLOAD_URL
GRAFANA_PLUGIN_LIST
GF_INSTALL_PLUGINS
23. How do you import a dashboard in Grafana?
Go to Dashboards > New > Import. You can paste JSON, upload a JSON file, or enter the ID of a dashboard from grafana.com. For example, ID 1860 is the popular Node Exporter Full dashboard.
During import, Grafana asks you to map the data source placeholders (like ${DS_PROMETHEUS}) to real data sources and to choose a folder. If the uid already exists, you can choose to overwrite.
Take quiz
1860
3000
9090
Data source inputs such as ${DS_PROMETHEUS}
Users to teams
Panels to alert rules
24. What are transformations in Grafana?
Transformations reshape query results in the browser before they reach the visualization. They are handy when you cannot, or do not want to, change the query itself.
- Merge and Join by field: combine results of several queries
- Organize fields: rename, reorder or hide columns
- Filter data by values: drop rows that do not match
- Group by and Reduce: aggregate rows or series
- Add field from calculation: derive a new column
They run in order, and since they happen client-side, very large results can make them slow.
Take quiz
Organize fields
Merge or Join by field
Convert field type
Inside the data source
Only in the Alertmanager
In the browser, after the query returns
25. What are Grafana folders used for?
Folders organize dashboards, library panels and alert rules. They are also the main place to set permissions, because everything inside a folder inherits the folder's access settings.
Nested folders are supported, so you can mirror team structure, for example Platform / Databases. Anything not in a folder goes into the General folder, which is best avoided in larger setups.
Take quiz
The folder's permissions
The folder's data source
The folder's Prometheus retention
Linux users
Alert rules and library panels
Docker images
26. How does Grafana work with Prometheus?
Grafana treats Prometheus as a data source. When a panel refreshes, Grafana's backend sends your PromQL expression to the Prometheus HTTP API (/api/v1/query_range) with a start, end and step, then plots the returned series.
The step is derived from the panel width, time range and min interval, so you rarely set it by hand. Use the legend format to label series, for example {{instance}}, and enable exemplars to jump from a metric point to a trace.
sum by (instance) ( rate(node_cpu_seconds_total{mode!="idle"}[$__rate_interval]) )
Grafana only visualizes here. Scraping, storage and recording rules stay in Prometheus.
Take quiz
/api/v1/targets
/api/v1/query_range
/metrics
Grafana
Prometheus
The browser
27. What is the difference between Grafana and Prometheus?
They solve different halves of monitoring and are usually deployed together.
| Prometheus | Grafana |
| Scrapes and stores metrics in its own time-series database | Queries data sources and visualizes the results |
| Query language: PromQL | Per-data-source query editors |
| Basic expression browser and graphs | Rich dashboards, Explore, annotations |
| Evaluates alert and recording rules | Unified alerting across many data sources |
| Metrics only | Metrics, logs, traces, SQL and more |
Think of Prometheus as the data store and Grafana as the window onto it.
Take quiz
Prometheus
Grafana
Alloy only
Prometheus builds multi-source dashboards natively
Grafana replaces the need for any time-series database
Grafana can show data from several different backends in one dashboard
28. What is the difference between Grafana and Kibana?
Both build dashboards, but they come from different ecosystems.
| Kibana | Grafana |
| Built for Elasticsearch and the Elastic Stack | Works with many data sources |
| Strong at full-text log search and Discover | Strong at time series, metrics-first dashboards |
| Index patterns and KQL | Native query editor per data source |
| Tied to Elastic security and licensing | Open core with plugins |
Many teams use Kibana for deep log search and Grafana for operational dashboards. Grafana also has an Elasticsearch data source if you want both views.
Take quiz
Elasticsearch
Prometheus
Loki
Grafana
Kibana
Logstash
29. How does Grafana Alerting work?
Grafana Alerting evaluates alert rules on a schedule, tracks the state of each resulting alert instance, and routes the ones that fire to people or systems.
- An alert rule runs its queries and expressions (reduce, math, threshold) every evaluation interval
- If the condition stays true for the pending period, the instance moves to Alerting
- Firing instances go to the built-in Alertmanager
- The notification policy tree matches their labels and picks a route
- Alerts are grouped and sent to a contact point unless a silence or mute timing applies
flowchart LR
A["Alert rule evaluation"] --> B{Condition true for pending period?}
B -- No --> C["Normal / Pending"]
B -- Yes --> D["Alerting instance"]
D --> E["Notification policy matches labels"]
E --> F{Silenced or muted?}
F -- Yes --> G["No notification"]
F -- No --> H["Contact point: Slack, email, PagerDuty"]
Take quiz
The panel type the alert was created from
The notification policy tree matching the alert's labels
The order in which dashboards were created
The condition stays true for the pending period
A user acknowledges the dashboard
The data source is restarted
30. What are the states of a Grafana alert rule?
Each alert instance (one label set) is always in a state. The main ones are:
- Normal: the condition is not met
- Pending: the condition is met but the pending period has not elapsed yet
- Alerting: the condition has held long enough, so notifications are sent
- NoData: the query returned nothing
- Error: the query or evaluation failed
For NoData and Error you choose the behavior on the rule: raise an alert, treat as Normal, or keep the last state. If the pending period is 0, an instance skips Pending and goes straight to Alerting.
Take quiz
Normal
NoData
Pending
The alert was silenced
The contact point is down
The query returned no data
31. What is the difference between contact points and notification policies?
They answer two separate questions. A contact point says where and how to send a notification. A notification policy says which alerts go where, and how often.
| Contact point | Notification policy |
| Integration: email, Slack, PagerDuty, webhook, Teams | Routing tree that matches alert labels |
| Holds the message template | Holds grouping and timing settings |
| Reusable across many policies | Points to exactly one contact point per route |
So you create a contact point for a team once, then write policies like team=database that route to it.
Take quiz
Notification policy
Contact point
Mute timing
Contact point
Annotation query
Notification policy
32. How do notification policies route alerts using labels?
Policies form a tree. The root is the default policy, and nested policies add label matchers such as severity=critical or team=database. An alert goes to the first matching branch, unless Continue matching is on.
Each policy also controls how notifications are batched:
| Setting | Default | Meaning |
| Group by | grafana_folder, alertname | Alerts with the same values are sent together |
| Group wait | 30s | Delay before the first notification of a new group |
| Group interval | 5m | Delay before sending updates for the group |
| Repeat interval | 4h | How often an unchanged firing alert is resent |
Mute timings can silence a policy on a schedule, such as maintenance windows.
Take quiz
Label matchers
Panel IDs
Dashboard folder names only
How often an unchanged firing alert is resent
How often the rule is evaluated
How long dashboards stay cached
33. What is the difference between Grafana-managed and data source-managed alert rules?
Where the rule is stored and evaluated is the key difference.
| Grafana-managed | Data source-managed |
| Stored in the Grafana database, evaluated by Grafana | Stored and evaluated by the data source ruler (Prometheus, Mimir, Loki) |
| Can query many data sources and combine them | Limited to that single data source |
| Supports expressions and multi-dimensional alerts | Uses native PromQL or LogQL rules |
| Grafana scales with the number of rules | Evaluation scales with the data source |
Data source-managed rules are a good fit when you already keep rules as code next to Prometheus or Mimir.
Take quiz
In the user's browser
In the Grafana image renderer
In the data source's ruler, such as Prometheus or Mimir
Data source-managed
Grafana-managed
Recording rules
34. How do you provision data sources and dashboards as code in Grafana?
Grafana reads YAML files from /etc/grafana/provisioning at startup. There are subfolders for datasources, dashboards, alerting and plugins.
# provisioning/datasources/prometheus.yaml apiVersion: 1 datasources: - name: Prometheus type: prometheus access: proxy url: http://prometheus:9090 isDefault: true
# provisioning/dashboards/default.yaml apiVersion: 1 providers: - name: default folder: Infra type: file updateIntervalSeconds: 30 options: path: /var/lib/grafana/dashboards
The dashboard provider watches the folder for JSON files. Provisioned dashboards cannot be saved from the UI unless allowUiUpdates is set, which keeps Git as the source of truth.
Take quiz
/etc/grafana/provisioning
/var/lib/grafana/plugins
/usr/share/grafana/public
The Prometheus targets page
A folder of dashboard JSON files
The browser's local storage
35. How can you manage Grafana resources with Terraform?
The official grafana/grafana Terraform provider lets you manage folders, data sources, dashboards, alert rules and contact points as code. You review changes in pull requests and apply them consistently across environments.
provider "grafana" { url = "https://grafana.example.com" auth = var.grafana_token } resource "grafana_folder" "infra" { title = "Infra" } resource "grafana_dashboard" "node" { folder = grafana_folder.infra.uid config_json = file("node.json") }
Authenticate with a service account token rather than a personal login.
Take quiz
The dashboard JSON through config_json
A Docker image tag
A PromQL recording rule only
A browser cookie
The admin's personal password in plain text
A service account token
36. Why use $__rate_interval instead of $__interval in Prometheus queries?
$__interval is calculated from the time range and panel width. Zoom in and it can shrink below your scrape interval, so rate() sees fewer than two samples in the window and returns nothing.
$__rate_interval fixes that. It is at least four times the scrape interval, calculated as max($__interval + scrape_interval, 4 * scrape_interval), which guarantees enough samples. Set the correct scrape interval in the Prometheus data source settings for this to work well.
# can show gaps when zoomed in rate(http_requests_total[$__interval]) # safe rate(http_requests_total[$__rate_interval])
Take quiz
Prometheus deletes samples when you zoom
Grafana disables rate() for short ranges
The window can shrink below the scrape interval, leaving fewer than two samples
Exactly one scrape interval
At least four times the scrape interval
Half the scrape interval
37. How do repeating panels and rows work in Grafana?
Repeating lets one panel or row clone itself once per value of a multi-value variable. Pick three servers in the $server dropdown and you get three panels, each with $server locked to one value.
- Create a variable with Multi-value or Include All enabled
- Open the panel or row options and choose the variable under Repeat options
- Pick the direction (horizontal or vertical) and the maximum panels per row
Repeated rows are useful when each server needs a full group of panels, while repeated panels suit a single chart per instance.
Take quiz
A constant value
A text box input
Multiple values or an All option
All values of the variable
No variable value
One value of the variable
38. How do you authenticate Grafana users with LDAP or OAuth?
Both are enabled in grafana.ini. LDAP uses a separate ldap.toml to map directory groups to Grafana roles. OAuth providers such as GitHub, Google, GitLab and Azure AD have their own [auth.*] sections.
[auth.github] enabled = true client_id = YOUR_CLIENT_ID client_secret = YOUR_CLIENT_SECRET scopes = user:email,read:org allowed_organizations = my-org role_attribute_path = contains(groups[*], 'sre') && 'Editor' || 'Viewer'
The role mapping is the key part. Without it, every new user lands with the default role. SAML is also available in Enterprise and Cloud.
Take quiz
ldap.toml
prometheus.yml
datasources.yaml
Which Grafana role a logged-in OAuth user receives
The OAuth redirect port
The dashboard refresh rate
39. Why were API keys replaced by service accounts in Grafana?
Legacy API keys were tied to an org with no real identity. They were hard to audit, could not easily be disabled, and many teams ended up with long-lived keys nobody owned.
A service account is a non-human identity with a role, and it can have several tokens. Tokens can expire, be revoked individually, and the account itself can be disabled. Actions are logged against the service account.
| API key (legacy) | Service account token |
| Belongs to an org, no identity | Belongs to a named service account |
| Cannot be disabled easily | Account can be disabled in one click |
| One credential per key | Multiple tokens, optional expiry |
Grafana deprecated API keys and migrated existing ones to service accounts.
Take quiz
A non-human identity with a role and its own tokens
A user's personal browser session
A data source credential
They never need a role
They can expire and be revoked individually
They bypass all permissions
40. How do you set up high availability for Grafana?
Run several Grafana instances behind a load balancer, all using the same external database, MySQL or PostgreSQL. The default SQLite file is local to one server and cannot be shared.
- Move sessions to the database or a remote cache such as Redis so users stay logged in on any node
- Keep identical configs, plugins and provisioning files on every instance
- Enable HA for alerting by setting
ha_peersin[unified_alerting]so instances gossip and avoid duplicate notifications - Make the database itself highly available
flowchart TD U[Users] --> LB["Load balancer"] LB --> G1["Grafana 1"] LB --> G2["Grafana 2"] G1 --> DB[(Shared MySQL or PostgreSQL)] G2 --> DB G1 <-->|alert gossip| G2
Take quiz
It does not support dashboards
It only stores users
It is a local file that cannot be shared between servers
Load balancer health checks
The database replication lag
Instances that share alert state to prevent duplicate notifications
41. How can you optimize slow Grafana dashboards?
Start by finding what is slow. Open the Query inspector on a panel and compare query time with rendering time. Then work through these fixes:
- Reduce the default time range and the number of panels on one dashboard
- Lower Max data points or raise the min interval so fewer points come back
- Use recording rules in Prometheus for expensive aggregations
- Use instant queries for Stat and Gauge panels
- Avoid heavy regex matchers and high-cardinality labels
- Be careful with variables that refresh on every time range change
- Enable query caching if you have Enterprise or Cloud
- Split a huge dashboard into several focused ones
Panels below the fold load only when scrolled into view, so layout order matters too.
Take quiz
The plugin catalog
The folder permissions page
The Query inspector
More panels per row
Recording rules
Longer default time ranges
42. How do you troubleshoot "No data" in a Grafana panel?
Work from the outside in, so you rule out simple causes first.
- Check the time range and the dashboard timezone
- Open the data source and run Save & test to confirm connectivity
- Run the same query in Explore to see if it returns anything
- Check variables: an empty value or an All regex can make the query match nothing
- Confirm metric and label names exist in the backend
- Look at the Query inspector response for errors or empty frames
- Read the Grafana server log at
/var/log/grafana/grafana.log
Permissions on the data source or folder can also hide results from some users.
Take quiz
The time range selected
The Linux kernel version
The plugin author
Annotations
Explore
Library panels
43. How do you secure a Grafana installation?
Grafana is often exposed to many users, so tighten these defaults:
- Change the default admin password, or disable the login form if you use SSO
- Serve over HTTPS (
protocol = https, with cert and key) or terminate TLS at a proxy - Disable anonymous access and user sign-up unless you need them
- Set
cookie_secure = trueand a suitablecookie_samesite - Keep
allow_embeddingoff unless required - Replace the default
secret_key, which encrypts stored credentials - Give data sources least-privilege, read-only credentials
- Use service accounts for automation and keep Grafana updated
Take quiz
The browser's dark mode preference
The dashboard refresh rate
Encrypted values such as data source credentials stored in the database
enable_gzip = true
cookie_secure = true
allow_embedding = true
44. How does Grafana correlate metrics, logs and traces?
Correlation works through shared identifiers and links between data sources. Three mechanisms matter most:
- Exemplars: Prometheus histogram samples can carry a trace ID that links straight to Tempo
- Derived fields: Loki extracts a trace ID from a log line and links to the trace
- Trace to logs and metrics: Tempo opens related logs or metrics for a span using shared labels like service name
flowchart LR M["Metric spike with exemplar"] --> T["Trace in Tempo"] L["Log line with traceID"] --> T T --> L2["Related logs in Loki"] T --> M2["Related metrics in Prometheus"]
Consistent labels across all three signals make the jumps accurate.
Take quiz
An exemplar containing the trace ID
A dashboard annotation
A folder permission
Compresses log chunks
Extracts a trace ID from log lines and links to the trace
Creates a new alert contact point
45. How do you template alert messages in Grafana Alerting?
Alert annotations and notification messages use Go templating. Labels are available through $labels and query results through $values.
summary: High CPU on {{ $labels.instance }} description: CPU is at {{ printf "%.1f" $values.B.Value }}% {{ define "slack.title" }} [{{ .Status | toUpper }}] {{ .CommonLabels.alertname }} {{ end }}
Named templates such as slack.title are defined under notification templates and then referenced from a contact point, so one template serves many integrations.
Take quiz
$panels
$labels
$folder
Jinja2
Handlebars
Go templates
46. How do you run Grafana behind a reverse proxy on a sub-path?
Tell Grafana its public URL and that it is served from a sub-path. Otherwise redirects and static assets point to the wrong place.
[server] domain = example.com root_url = %(protocol)s://%(domain)s/grafana/ serve_from_sub_path = true
location /grafana/ { proxy_pass http://localhost:3000/; proxy_set_header Host $http_host; }
If you use Grafana Live, also forward websocket traffic with the Upgrade and Connection headers.
Take quiz
http_port = 80
serve_from_sub_path = true with a matching root_url
enable_gzip = true
Accept-Language
Host
ETag
47. Explain the execution flow when a Grafana dashboard loads?
Loading a dashboard involves the browser, the Grafana backend and each data source. The backend acts as a secure query proxy, so credentials never reach the browser.
sequenceDiagram participant B as Browser participant G as Grafana backend participant D as Data source B->>G: GET /api/dashboards/uid/abc G-->>B: Dashboard JSON B->>G: POST /api/ds/query (per panel) G->>G: Check permissions, decrypt credentials G->>D: Native query (PromQL, SQL, LogQL) D-->>G: Result G-->>B: Data frames B->>B: Apply transformations and render
The dashboard JSON arrives first, then each panel posts its queries to /api/ds/query. The backend authorizes the request, loads the data source config, forwards a native query, and returns data frames. Transformations and rendering happen in the browser.
Take quiz
/api/v1/targets
/api/ds/query
/metrics
Inside the data source
In the browser after data frames return
On the load balancer
48. When should you use the Mixed data source in Grafana?
Use Mixed when a single panel needs queries from more than one data source. Each query row picks its own data source.
Typical cases are comparing production and staging metrics from two Prometheus servers, or putting a business number from PostgreSQL next to an infrastructure metric on the same graph. You can then use transformations to join or merge the results.
If you only need the same dashboard for different environments, a data source variable is cleaner, because it swaps the data source for the whole dashboard instead of mixing inside one panel.
Take quiz
When you want to disable a data source
When you need to merge dashboards across folders
When one panel needs queries from several data sources
An annotation query
A data source variable
A library panel
49. What is the difference between Server and Browser access modes for data sources?
The access mode decides who connects to the data source.
| Server (proxy) | Browser (direct) |
| Grafana backend sends the request | User's browser sends the request |
| Data source only needs to be reachable from Grafana | Must be reachable from every user's machine |
| Credentials stay on the server | Credentials exposed to the browser |
| Works with alerting and reporting | Cannot be used for alerting |
| Recommended default | Deprecated and discouraged |
Choose Server mode for almost everything. Browser mode also requires CORS configuration on the data source.
Take quiz
The user's browser
The load balancer
The Grafana backend
Alert evaluation runs on the Grafana backend, not in a browser
Alerts only work on Linux
Browsers cannot display alerts
50. How do you back up and restore Grafana?
Back up the pieces that hold state, not just dashboards:
- The database: copy
/var/lib/grafana/grafana.dbfor SQLite, or dump MySQL or PostgreSQL grafana.iniand anyldap.toml- The provisioning folder
- Custom plugins in
/var/lib/grafana/plugins - The
secret_keyvalue
The secret key is easy to forget. Data source passwords in the database are encrypted with it, so a restore without the same key leaves those credentials unusable.
To restore, stop Grafana, put the database, config and plugins back, then start it. For extra safety, also keep dashboards as JSON in Git or Terraform.