How Prometheus and Grafana dashboards and alerting fit together
If Prometheus already scrapes your targets and you need dashboards and alerts that people trust, the first decision is which component owns which job. Grafana reads Prometheus through its Prometheus data source, which sends PromQL queries to Prometheus and draws the results as panels. The supported way to connect is the HTTP query API, so Grafana never reads Prometheus's local storage files directly. Prometheus remains the system that collects, stores and evaluates the data, while Grafana is the place where people explore it and build dashboards on top.
Alerting can run in two places, and the choice shapes your on-call setup. Prometheus evaluates alert rules and sends firing alerts to Alertmanager, which handles grouping, inhibition, silences and routing to receivers. Grafana can also evaluate alert rules against the Prometheus data source and send notifications through its own contact points. Many teams keep paging rules in Prometheus and Alertmanager so the rules live with the code and the metrics, then use Grafana for dashboards and review. Decide which one is the paging path before anyone builds a dashboard, because two systems firing on the same problem will produce duplicate pages.
Prometheus has no paid edition, and its Apache-2.0 license carries no license fee, so the cost of this pairing sits in infrastructure, storage and people. Grafana is also open source, but its licensing has changed over time, and some features and support tiers are commercial, so confirm the edition and license terms you intend to run with Grafana Labs licensing. Ask any implementation partner to separate one-time work (data source setup, dashboard design, alert review) from recurring work (upgrades, retention tuning, on-call ownership) so you can see who carries each cost.
What you need in place before connecting Grafana to Prometheus
Connecting Grafana to Prometheus is simple once both sides are sized and reachable. The cards below cover the versions, the Grafana database, the network path, and the authentication settings that decide whether dashboards and alerts work reliably from the first day.
Prometheus version and LTS line
Pick a current 3.x Prometheus release or the 3.13 long-term support line, which receives bug fixes until July 31, 2027. Minor releases stop receiving bug fixes after about six weeks, so a version pinned to an older minor line will drift out of support quickly. Confirm the version you run against the release cycle page before wiring Grafana to it, because query behavior and API details are what your dashboards depend on.
Release cycle pageGrafana version and support window
Choose a Grafana release that is still inside its support window. Grafana supports each minor release for 9 months and the last minor of a major version for 15 months, so check the upgrade guidance before you standardize. Plan to apply patch releases, which Grafana publishes at least monthly, as part of normal operations rather than as an emergency task.
Upgrade guidanceConfiguration database for Grafana
Grafana stores its configuration in SQLite by default. Use SQLite only for evaluation, and provide MySQL 8.0 or later or PostgreSQL 12 or later for production. Production and high availability both depend on this choice, because two or more active-active Grafana servers must share one external database. Confirm the database backup and restore process before dashboards and alert rules become business-critical.
Installation docsNetwork path from Grafana to Prometheus
Grafana queries Prometheus over HTTP, so the Grafana server, and every node in a Grafana high availability pair, must reach the Prometheus HTTP port through your firewalls and any reverse proxy. Alerting rules evaluated by Grafana also need that path. Test the route from each Grafana node, not only from your workstation, and document which segments cross security zones.
TLS certificates and basic authentication
If Prometheus uses TLS with client certificates, Grafana needs the matching CA bundle and client certificate, and the certificate chain must be trusted by the Grafana host. If Prometheus uses HTTP basic authentication, only send credentials over TLS, because without it credentials travel in cleartext. Store the password in a secrets mechanism rather than in dashboard or data source definitions, and confirm the minimum TLS version your security baseline requires.
Prometheus security modelSizing against the installation docs
Size the Grafana host against the installation docs rather than a fixed guess. The docs describe a small deployment under 25 concurrent users at 2 cores and 2 to 4 GB of RAM, and heavier dashboards, more users or more alert rules will need more capacity. Ask your Grafana and infrastructure contacts to confirm the figures for your user count and query load before you commit to a host size.
- Small deployment ceiling
- 25 users
Configuring the Prometheus data source and first dashboards
This sequence connects Grafana to a running Prometheus server, confirms that PromQL returns data, builds the first panels, and moves the configuration into files that Grafana loads at startup. Each step ends with a check so the team knows the link works before it builds anything on top of it.
Install Grafana and confirm the service starts
The platform team installs Grafana from a package for its operating system or from the Docker image or Helm chart, following the installation guide. For a small evaluation, the default SQLite database is acceptable, but production and high availability require MySQL 8.0 or later or PostgreSQL 12 or later, so confirm the database choice before going further. Start the service and sign in to the web interface as the initial administrator. The step is complete when the login page loads over the expected address and the administrator can open the home page without errors.
Add the Prometheus data source
In Connections, add a Prometheus data source and enter the URL of the Prometheus server that Grafana can reach over the network, such as the internal address of the server on its web port. Choose the authentication method the server expects: none on a trusted internal network, basic authentication, or TLS client certificates if the server is configured for them. Credentials should be stored in Grafana's secure fields rather than in plain configuration. The step is complete when the data source test returns a success message confirming that Grafana reached Prometheus and read its build information.
Confirm query results in Explore
Open Explore, select the new Prometheus data source, and run a simple query such as up, which reports whether each scrape target is reachable. Use the code editor for PromQL and the metric browser to confirm that the metric names match what the server stores. If the query returns no series, check that Prometheus has completed at least one scrape and that the time range covers the period when data was collected. The step is complete when the query returns one series per scrape target, each with its job and instance labels.
Build the first PromQL panels
Create a new dashboard and add panels for a small set of questions, such as target availability using the up metric, request rate using rate() over a counter, and a latency quantile from a histogram where one exists. Set units and thresholds on each panel and use legend formats that show the labels operators need to identify a target. Keep the first dashboard small so that each panel can be checked against a known value. The step is complete when every panel renders data for the selected time range and a spot check of one value matches the result of the same query run in Explore.
Export the data source and dashboards as files
Write a data source provisioning file in YAML or JSON that defines the Prometheus URL, access mode and default flag, and place it in the provisioning directory that Grafana reads at startup. Export the dashboard JSON from Grafana and store it in version control alongside a dashboard provider file that points Grafana to the dashboard directory. Secrets should be referenced through environment variables or the secret mechanisms your organization already uses rather than written into the files. Grafana's provisioning documentation also covers further as-code options, including Terraform and Git Sync, which teams can evaluate once the file layout is stable.
Restart Grafana and verify the provisioned setup
Restart the Grafana service so it loads the provisioning files, then check that the Prometheus data source appears under Connections without anyone having created it by hand and that the dashboards appear in the expected folder. Run the data source test again and open one provisioned dashboard to confirm its panels return data. Keep a copy of the files in version control so the setup can be rebuilt on a new server. The step is complete when a fresh instance started from the same files shows the same data source and dashboards with working panels.
Grafana alerting or Alertmanager: which one owns notifications
In this model, Prometheus evaluates alert rules and sends firing alerts to Alertmanager, which groups, deduplicates, inhibits and silences them before notifying receivers. Grouping collapses related alerts into one notification, inhibition suppresses downstream alerts when a root cause is already firing, and silences cover planned maintenance. Alertmanager can run as a cluster for high availability using its --cluster flags, and Prometheus should be pointed at every Alertmanager instance rather than at a load balancer in front of them.
- Rules live with Prometheus: Alert rule files are loaded by Prometheus, so they can sit in the same Git repository as scrape configuration and be reviewed together.
- Routing lives in one place: The Alertmanager configuration holds receivers, routes and inhibition rules, which gives the platform team a single file to audit.
- Duplicate risk is controlled by design: Because every Prometheus replica sends to the same Alertmanager cluster, the cluster deduplicates identical alerts.
- Ownership is split: Dashboards may be edited by many people in Grafana, but routing changes belong to whoever owns Alertmanager.
- Receiver coverage is your responsibility: Confirm which receivers your teams need and test each one before relying on it.
Confirm that your Prometheus replicas can reach every Alertmanager instance and that your team can operate the cluster configuration before you commit to this path.
In this model, Grafana evaluates alert rules against its data sources, including Prometheus, and manages contact points, notification policies and silences in its own interface and provisioning files. It suits teams that already manage most of their operational views in Grafana and want alert rules next to the panels they describe. The trade-offs shift toward Grafana's configuration and away from Alertmanager's clustering model, so the team should understand where state is kept before relying on it.
- Rules are tied to dashboards: Engineers can create an alert from a panel, which speeds up small changes but can make rules hard to review in bulk.
- Duplicate notifications need extra design: The Grafana high availability guidance notes that alerting needs additional configuration to avoid duplicate notifications when several Grafana servers run.
- High availability depends on the database: Production and high availability setups require MySQL or PostgreSQL rather than SQLite, so the alerting state sits in that shared database.
- Versioning is possible but deliberate: Provisioning files and Git-based options can keep alert definitions in version control, but this is a setup choice that someone must maintain.
- Some authentication features need a paid edition: SAML, team sync and SCIM are limited to Grafana Enterprise and Grafana Cloud, which affects who can be assigned to alert ownership.
Check the Grafana high availability guidance and your provisioning workflow before deciding, and confirm which Grafana edition your organization will license.
The choice affects who gets paged, how often, and who must change a rule when something goes wrong. Duplicate notifications are the most common complaint in mixed setups, where both Prometheus rules and Grafana alert rules fire for the same condition to the same people. Ownership also matters during an incident, because an on-call engineer needs to know which system to silence and which to edit. Teams should write this down before the first production alert is routed.
- One owner per alert: Assign each alert to either Alertmanager or Grafana, not both, to avoid two paths for one condition.
- Silences live in one place: Silencing in the wrong tool can leave the other path paging, so document where silences are created.
- Version history differs: Rule files in a Git repository give a reviewable history, while UI edits need provisioning or export to be tracked.
- Audit evidence differs: Ask which system records who changed a rule, who received a notification and when, and whether that record is retained.
- Migration is possible but not free: Moving alerts between the two paths means retesting routes, receivers and inhibition behavior.
Run a test alert through your chosen path, confirm one notification arrives, and confirm your on-call runbook names the owning system.
Before building dashboards and alert rules, your team should confirm which alerting path it will operate, who maintains it, and how changes are reviewed. The decision depends on existing skills, the number of Prometheus replicas, whether Alertmanager already exists in your environment, and how strictly your compliance team expects alert configuration to be controlled. A short written decision record makes later audits and handovers easier to answer.
- Operator skills: Confirm whether the team already runs Alertmanager or has more experience with Grafana provisioning.
- Topology: Count Prometheus replicas and Grafana servers, since both affect duplicate notification risk.
- Change control: Decide whether alert rules must go through pull request review.
- Receiver inventory: List every paging, chat and ticketing destination and check which path reaches each one.
- Evidence: Decide which logs or records will show notification history for your auditors.
Record the chosen path in your runbook and confirm the configuration with your platform and security owners before go-live.
Designing dashboards that stay readable as the estate grows
Dashboards built on PromQL are only as readable as the labels underneath them. Every panel is a query over series that Prometheus scraped under a job and instance pair plus whatever labels your relabeling added, so the names you choose at scrape time become the filter, legend and grouping logic in Grafana. Agree on one naming convention for jobs and environments before the first dashboard is built, and check that exporters from different teams produce the same label names for the same concept. Query cost also follows label design: a panel that groups by a high-cardinality label touches far more series than one grouped by a service name, and the cost multiplies when a dashboard refreshes many such panels at once. Ask each dashboard owner which labels their panels group by, and review that list when a new exporter is added.
Template variables in the Grafana Prometheus data source are how one dashboard serves many hosts, clusters or services without being copied. Build variables from label values (for example, a job variable driving a label_values query) and scope them with a job or environment matcher so the dropdown does not list the whole estate on every load. Keep the variable definitions and the panel queries in version control, because the same Grafana provisioning mechanism that loads data sources and dashboards from files at startup can load them consistently across environments. Grafana documents further as-code options, including Terraform and Git Sync, so the team can choose the tool its change process already uses. Test each change in a non-production Grafana before it reaches the on-call team.
Retention is the limit that surfaces last and hurts most. Prometheus local storage keeps data for 15 days by default, and that setting is configurable by time or size, so a dashboard asking for a quarter of history returns gaps on a default server. Before you promise long views to capacity planners or auditors, decide how far back each dashboard must reach and which store will hold that data, whether Thanos, Grafana Mimir or another long-term store that accepts remote write. Then confirm that the same PromQL works against that store, because the goal is to repoint the existing Grafana data source rather than rewrite every panel. Confirm the retention settings with your own storage sizing before committing to a window.
How queries and alerts flow from targets to Grafana and Alertmanager
The diagram starts with scrape targets in the data network, which Prometheus pulls over HTTP using service discovery or static configuration. Prometheus stores samples in its local time series database and evaluates alert rules on its own schedule, then sends firing alerts to Alertmanager. Grafana sits in the operator network and queries Prometheus through its data source using PromQL. An optional remote write path forwards samples to long-term storage. Check that the trust boundary crossings are allowed by your firewall rules and that every Alertmanager instance is reachable from Prometheus.
Metrics flow from targets to Prometheus, then to Alertmanager, Grafana and optional long-term storage.
Pointing the same dashboards at Thanos or Mimir when storage scales out
Local Prometheus storage is a single-node database. The Prometheus storage documentation states that it is not clustered or replicated, so a growing estate eventually needs remote write to send samples to an external long-term store such as Thanos or Grafana Mimir. The decision point is usually retention and query load rather than a fixed server size. Before you change anything, confirm with your chosen store how it receives remote write, how it is scaled and whether its query API is compatible with the PromQL your dashboards already use. Also confirm what each store needs in terms of object storage, compaction and retention settings, since these are operated separately from the Prometheus servers that scrape.
The goal is to keep the Grafana side stable while the query endpoint moves. In practice, this means adding the long-term store as a new Prometheus-type data source in Grafana, or pointing the existing data source at the query frontend, and keeping the data source UID and dashboard variables unchanged so panels and alert references still resolve. Where you manage Grafana as code, define the data source in a provisioning file so the change is reviewed and reproducible. Remember that dashboards refer to data sources by UID, so renaming one in a copy of the environment can break every panel silently. Keep a dashboard JSON export in version control before the switch so you can compare and restore.
Test three things before you cut over. First, query parity: run the same PromQL expressions against the local server and the long-term endpoint over an overlapping time range and compare results, including rate() and histogram quantile queries, which are sensitive to scrape timing and deduplication. Second, label consistency: confirm that external labels such as cluster or replica, set in the Prometheus configuration, match what the store expects, so that series are not duplicated or split across identities. Third, retention: check that data older than the local retention window, which defaults to 15 days in Prometheus, is returned from the long-term store, and that the store's own retention matches the period your compliance and incident review needs. Record the results, and confirm the performance and cost figures with the vendor or your own load tests rather than assuming them.
Securing the Grafana to Prometheus path
Grafana queries Prometheus over HTTP, and Prometheus exposes its query, admin and metrics endpoints to the people and systems around it. Each hop on this path needs its own decisions about transport encryption, authentication, admin surface and cookies, so the dashboards and alerts stay trustworthy and the data stays protected.
Encrypt Prometheus traffic with TLS
Prometheus supports TLS and client certificate authentication with TLS 1.2 as the minimum version. Configure the web listener with a web.config.file that sets the certificate, key and client CA, and require client certificates for Grafana if your network allows it. Check that Grafana's data source uses the https URL and the matching CA bundle, so certificate errors do not push teams toward disabling verification.
Limit basic authentication to TLS
Prometheus supports HTTP basic authentication with bcrypt-hashed passwords, which is a reasonable fallback for small estates. Basic authentication without TLS sends credentials in cleartext, so never enable it on a plain HTTP listener. Confirm that every scraper, Grafana instance and automation account uses the same protected path, and store the password hashes and any Grafana data source secrets in your secret manager rather than in dashboard JSON.
Put an authenticating proxy in front
Prometheus has no built-in single sign-on, and its security model notes there is no built-in CSRF protection on mutating endpoints. Place an authenticating reverse proxy in front of the web UI and API so that users sign in through your identity provider. Make sure the proxy also covers the API paths Grafana uses, and test that direct access to the Prometheus port from user networks is blocked.
Keep admin APIs disabled
Prometheus admin HTTP APIs are disabled by default. The --web.enable-admin-api flag enables destructive operations such as deleting series, and --web.enable-lifecycle enables reload and shutdown endpoints. Leave both off in production unless a documented runbook needs them, and if a pipeline must reload configuration, restrict that call to the automation host through the proxy.
Harden Grafana cookies and browser policy
Grafana's security hardening guidance recommends secure and SameSite cookies, a Content Security Policy and Trusted Types. Set the cookie options in the [security] section of grafana.ini, and enable a Content Security Policy that your plugins and dashboard panels still satisfy. Test the login flow after each change, because strict policies can break third-party panels that load scripts from external hosts.
Hide version and require metrics authentication
Grafana can hide its version from unauthenticated users and can require authentication for its own metrics endpoint. Both reduce what an outsider learns before login. Confirm that the Grafana metrics scrape from Prometheus uses a dedicated credential with read-only scope, and that the domain verification setting matches the hostname users actually open, which guards against DNS rebinding.
Plan SSO against your Grafana edition
LDAP, generic OAuth, Entra ID, Okta, GitHub, GitLab and Google OAuth, auth proxy and JWT are available in all Grafana editions. SAML, team sync, active sync and SCIM provisioning are available only in Grafana Enterprise and Grafana Cloud. If your identity provider requires SAML or automated provisioning, ask for the Enterprise option in writing before you design the access model, because that changes the license and cost conversation.
Grafana authentication docsMapping Prometheus labels and Grafana roles to dashboards and alerts
This table maps each Prometheus label or Grafana object to the place it controls, along with the purpose and the failure that follows when naming is inconsistent. Read it before building dashboards or alert rules so that filters, ownership and notification routing agree from the start. The main takeaway is that label names set in Prometheus are what every Grafana variable, folder and Alertmanager route depends on.
| Source field | Destination | Purpose | Risk if inconsistent |
|---|---|---|---|
| job label on scrape targets | Grafana dashboard variable for job | Lets one dashboard filter the same service across environments | Panels show no data because the variable matches a different job name |
| instance label on scrape targets | Grafana variable for instance, usually hidden or multi-select | Narrows panels to one host or process during investigation | Duplicate instance values across scrape jobs merge series and distort rates |
| Custom target labels such as env, team or service | Grafana variables and dashboard links | Filters dashboards by ownership and environment without separate copies | Mixed casing or synonyms such as prod and production split one service into two views |
| Custom target labels such as team | Grafana folder or dashboard tag | Shows which team owns a dashboard and who receives its alerts | Dashboards with no owner label become orphaned and nobody updates their queries |
| Grafana folder and team permissions | Who can edit or view a dashboard and its alert rules | Limits edits to the owning team while allowing others to read | Broad editor rights let unrelated teams change shared panels or silence their own alerts |
| Alert rule labels such as severity and team (set in Prometheus or Grafana alert rules) | Alertmanager route matchers and receivers | Sends each alert to the correct on-call group and escalation path | Missing or misspelled labels fall through to the default receiver, so pages go to the wrong team |
| Alert rule labels used for grouping (for example, alertname and cluster) | Alertmanager group_by setting | Bundles related alerts into one notification | Grouping on high-cardinality labels floods responders with one message per instance |
| Alert rule labels used for suppression (for example, a shared cause label) | Alertmanager inhibition rules and silences | Stops downstream alerts while a root cause is already firing | Inhibition keyed on a label that is absent or renamed lets symptom alerts page during an outage |
Questions teams ask before connecting Prometheus to Grafana
Did Grafana's licensing change, and can we still use it freely?
Yes, you can still use Grafana, but the license changed. On April 20, 2021, Grafana Labs relicensed Grafana, Loki and Tempo from Apache License 2.0 to AGPLv3. Plugins, SDKs and agent software kept other licenses. Grafana Enterprise is offered as a non-AGPL commercial option. Whether AGPLv3 fits your organization depends on how you modify and expose the software, so have your legal team review the terms on the Grafana Labs licensing page against your planned use. Prometheus itself is Apache-2.0, so the two components carry different license obligations that your review should cover separately.
What drives the cost of running Prometheus with Grafana?
The software is free to download, so cost comes from four components: infrastructure, storage, implementation and the people who run it. Infrastructure covers the servers or Kubernetes capacity for Prometheus, Grafana and Alertmanager, plus a database for Grafana's configuration. Storage grows with the number of active series and the retention you choose. Implementation covers design, dashboards, alert rules and identity integration, usually a one-time effort. Operations, upgrades and on-call response recur. Ask any quote to separate these lines so you can see which costs are one-time and which repeat each year.
How long does setting up Prometheus and Grafana take?
Duration depends on the scope you agree in writing, not on the software alone. The main drivers are how many systems you need to monitor, how many exporters and data sources must be configured, how many dashboards and alert rules your teams need, whether single sign-on is required, and whether your network is air-gapped or firewalled. Teams with an inventory of targets and clear alert owners usually move faster than teams that have to decide these things during the build. Ask for a timeline that lists each phase and what the client must provide in each one.
Can our own team set this up without a partner?
Yes, a capable platform team can deploy Prometheus and Grafana without an outside partner. The work is well documented, and the basic data source connection is a small step. The effort goes into the parts that take judgment: sizing storage, writing PromQL that answers real questions, designing alert routing so that the right people are paged, hardening access and keeping upgrades on a schedule. Compare the time your team has against those tasks. A partner is most useful when the scope is fixed in writing and when your staff cannot spare the time for design and testing.
What does the work need from our team?
Three inputs matter most. First, a metrics inventory: the hosts, services, databases and endpoints to monitor, with the owner of each. Second, alert ownership: a named team for each alert, the escalation path, and who receives notifications outside working hours. Third, identity decisions: whether Grafana users sign in through your existing directory, which roles map to which folders and data sources, and whether SAML or SCIM is required, since the Grafana authentication docs list those as Enterprise or Grafana Cloud features. Without these decisions, dashboards and alerts tend to be rebuilt after go-live.
When do we need Thanos or Mimir instead of a single Prometheus?
Plan for a long-term store when one Prometheus server can no longer hold the retention you need or when queries across many servers become slow. Prometheus stores data in local two-hour blocks with a default retention of 15 days, and its storage docs state that local storage is not clustered or replicated. Remote write lets Prometheus send samples to external long-term storage. Thanos and Grafana Mimir are two options for that role. The Grafana dashboards keep the same PromQL queries, so the main change is the data source endpoint. Confirm sizing, retention and high availability requirements before choosing.
Can Grafana alerting replace Alertmanager?
Grafana can evaluate alert rules and send notifications, but Prometheus and Alertmanager are the usual pair for alerts that come from Prometheus data. Alertmanager handles grouping, inhibition and silences, and it can run as a cluster for high availability. Prometheus should point at every Alertmanager instance rather than a load balancer. Many teams keep Prometheus rules and Alertmanager routing as the primary path and use Grafana alerting for dashboards and data sources outside Prometheus. Decide which system owns each alert so that one event does not page the same people twice.
How DeployOpen scopes and delivers Prometheus and Grafana work
DeployOpen plans, builds, documents and supports Prometheus and Grafana dashboards and alerting in infrastructure you control, including your cloud accounts, data centers or air-gapped networks. Each engagement starts from a written scope that names the data sources, dashboards, alert rules and handover materials, so your team knows what it receives before work begins.
How we scope
- Inventory the Prometheus servers, exporters, data sources and Grafana instances that the dashboards will depend on.
- Agree which dashboards, PromQL panels and alert rules are in scope, and who owns each one after handover.
- Decide with you whether Grafana alerting or Alertmanager sends notifications, and record the reasoning in the written scope.
How we build
- Configure the Prometheus data source in Grafana and provision it as code so it loads at startup.
- Build dashboards on PromQL queries that you can review, version and reproduce in a second environment.
- Test alert rules and notification routes against real failure conditions before they page anyone on call.
How we hand over
- Deliver dashboards, data source and alerting definitions as YAML or JSON files stored in your repository.
- Document query logic, label conventions, alert ownership and the steps to add a new dashboard or target.
- Walk your platform and on-call teams through the setup and record the open items that remain for your own team.
How we support
- Support is available as a retainer for upgrades to Grafana and Prometheus, dashboard changes and alert tuning.
- Retainers can include retesting of alert routes after upgrades, storage changes or a move to Thanos or Mimir.
- Ask for the support terms, response expectations and exclusions in the written quote before you sign.

