Skip to main content
In this lesson we’ll explore Prometheus’ built-in visualization option: console templates. Console templates let you build custom HTML pages using Go templating. Inside these pages you can embed Prometheus metrics, PromQL queries, and charts — effectively creating small, reusable dashboards by composing template fragments for headers, footers, content blocks, and drilldowns.
A dark-themed slide titled "Console Templates" explaining that console templates let you create custom HTML pages using Go templating, and that Prometheus metrics, queries, and charts can be embedded in those templates. Two words ("Console templates" and "embedded") are highlighted.
Where console templates live
  • Template files are stored on disk, typically under /etc/prometheus/consoles.
  • Prometheus ships with several example templates you can reuse or adapt.
  • Templates are rendered at request time; you usually do not need to restart Prometheus after adding or editing files (permissions permitting).
Typical directory listing (example) You can also inspect the directory directly:
Understanding template composition
  • Anything inside double curly braces {{ ... }} is a Go template expression.
  • Most console files import shared template fragments such as head, tail, and content wrappers.
  • Built-in helper templates (e.g., prom_query_drilldown) render metric values and provide clickable drilldowns into the Prometheus expression browser.
Example excerpt from index.html.example (kept in the template directory):
Viewing consoles in the browser Open your Prometheus web UI and navigate to the /consoles path, for example: http://<prometheus-server>:9090/consoles/index.html.example The example consoles include dashboard-like pages such as a Node overview which shows CPU, disk I/O, memory, and a right-hand summary panel for system stats.
A Prometheus Node Overview dashboard screenshot showing metrics for host 192.168.1.168:9100, with graphs for CPU usage, Disk I/O utilization and memory, plus a right-hand summary panel of CPU, memory, network and filesystem stats. The left side shows a Linux desktop with a Firefox window and application launcher.
Console templates are served directly from disk under /consoles. Ensure the Prometheus process can read any files you add there. Templates are loaded at request time, so you generally do not need to restart Prometheus after adding or modifying a console file.
Key built-in template helpers (common)

A minimal example: creating demo.html

This step-by-step shows how to create a small console that uses the shared header/footer, displays a metric value as a clickable drilldown, and embeds a chart by referencing Prometheus’ own graph UI inside an iframe.
  1. Change to the consoles directory and open an editor:
  1. Paste the following HTML (this is regular HTML using Go template expressions to include the shared fragments):
Notes:
  • The {{ template "prom_query_drilldown" "node_memory_Active_bytes" }} line renders the current value and makes it clickable so it opens the expression in Prometheus’ expression browser.
  • Using an iframe that points to /graph embeds Prometheus’ graph UI for that PromQL expression. This is a simple, compatible way to present charts without external dashboard tools.
  1. Save and open the page:
http://<prometheus-server>:9090/consoles/demo.html You should see the shared header, the H1 title, the active memory value rendered by the drilldown template, and an embedded time-series graph for node_memory_Active_bytes. Example rendered metric text might look like:
Clicking the drilldown will open the expression browser with the series, for example:
If you add files under /etc/prometheus/consoles, ensure ownership and permissions allow the Prometheus process to read them (e.g., chown prometheus:prometheus and appropriate chmod). Otherwise the templates will not be served.
What you can build with console templates
  • Small, focused dashboards that combine metric values, charts, tables, and drilldowns.
  • Reusable template fragments for organization-wide dashboards (headers, sidebars, footers).
  • Per-host or per-service pages that link directly into the Prometheus expression browser.
Links and references

Watch Video

Practice Lab