Grafana drillthrough links aren’t just about navigating to another dashboard; they’re a way to dynamically pass context, allowing you to pivot from a high-level overview to a specific slice of data without manually reconfiguring queries.

Let’s say you have a dashboard showing overall server CPU usage across your fleet. You’ve got a graph with a panel displaying the average CPU utilization per host. You want to be able to click on a specific host in that graph and jump to another dashboard that shows detailed metrics only for that host.

Here’s how we set that up.

The Goal: Click a point on a graph in Dashboard A, and land on Dashboard B, with Dashboard B filtered to show data for the specific host that point represents.

Dashboard A: The Source Dashboard

  1. Add a Panel: Create a new panel, or edit an existing one. For this example, let’s assume it’s a Graph panel.

  2. Configure the Query: Your query should return at least two pieces of information: the metric value (e.g., CPU usage) and a label that identifies the context you want to pass (e.g., host or instance).

    • Prometheus Example:
      avg by (host) (rate(node_cpu_seconds_total{mode="idle"}[5m]))
      
      Here, host is the label we want to use for drilling through.
  3. Enable "Drilldown" Links:

    • In the panel edit view, scroll down to the "Panel options" or "Links" section (the exact location can vary slightly by Grafana version).

    • Click "Add link".

    • Type: Select "Dashboard".

    • Dashboard: Choose the target dashboard (Dashboard B) from the dropdown.

    • Title: Give it a descriptive title, like "View details for {{host}}". The {{host}} here is a Grafana template variable that will be replaced by the actual value of the host label from the clicked data point.

    • URL: This is the crucial part. You’ll leave this blank by default, and Grafana will automatically construct the URL based on the dashboard you selected and the "Query parameters".

    • Query parameters: Click "Add query parameter".

      • Key: This is the name of the variable in your target dashboard (Dashboard B) that you want to set. Let’s say Dashboard B uses a variable named host_filter. So, enter host_filter.
      • Value: This is where you tell Grafana what value to put into that variable. You’ll use a Grafana template variable here, referencing the label from your current panel’s data. Enter $host. This $host refers to the host label returned by your query in Dashboard A.
  4. Save: Save the panel and the dashboard.

Dashboard B: The Target Dashboard

  1. Add a Variable: This dashboard needs a variable to receive the context passed from Dashboard A.

    • Go to "Dashboard settings" (the gear icon) -> "Variables".
    • Click "Add variable".
    • Name: This must match the Key you defined in the "Query parameters" on Dashboard A. So, enter host_filter.
    • Type: Usually "Query".
    • Data source: Select your data source (e.g., Prometheus).
    • Query: This query should fetch values for the variable based on the data source. Crucially, it should use the variable itself to filter its own results, or at least be aware of it. For a Prometheus data source, to allow selection of multiple hosts (which is good practice for variables), you might use:
      label_values(node_cpu_seconds_total, host)
      
      However, to make it dynamically filter when a drillthrough link is used, you need to ensure the variable can accept the incoming value. The simplest way is to have it query all possible hosts and then rely on the panel queries to filter using this variable.
    • Multi-value / Include All: For drillthrough, you typically don’t want multi-value or "Include All" enabled on the variable that receives the drillthrough. You want it to be a single, specific value. So, disable "Multi-value" and "Include All option".
    • Save: Save the variable.
  2. Configure Panels: Now, all the panels on Dashboard B that you want to be filtered by the host_filter variable need to use it in their queries.

    • Edit a panel on Dashboard B.
    • Modify its query to include the host_filter variable.
    • Prometheus Example:
      node_cpu_seconds_total{mode="idle", host=~"$host_filter"}
      
      The =~ operator is important here if you ever wanted to allow multi-select for the variable, but for a single drillthrough value, = would also work. Using =~ is generally more flexible for variables.
    • Save: Save the panel and the dashboard.

How it Works:

When you click on a data point in Dashboard A, Grafana identifies the host label associated with that point. It then constructs a URL for Dashboard B. This URL includes a query parameter: ?var-host_filter=the_specific_host_name. When Dashboard B loads, it sees this var-host_filter parameter, and its host_filter variable automatically updates its value to the_specific_host_name. Finally, any panel on Dashboard B whose query uses $host_filter will then only display data for that specific host.

The Hidden Gem:

The {{variable}} syntax for the link title is powerful. You can not only use labels from your current data point ({{host}}, {{instance}}, {{job}}), but also any other variables defined on your source dashboard. For instance, if you had a datasource variable on Dashboard A, you could make your link title "View details for {{host}} on {{datasource}}".

The next hurdle is often making drillthrough links work across different data sources or when you need to pass multiple variables simultaneously.

Want structured learning?

Take the full Grafana course →