> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/investigate/dashboards-and-alerts/dashboard-schema.md).

# Dashboard schema

A dashboard is stored as a JSON document called the **preset**. When you manage dashboards with [Terraform](https://docs.groundcover.com/investigate/dashboards-and-alerts/managing-dashboards-with-terraform.md), the `preset` argument of the `groundcover_dashboard` resource is that document, passed as a JSON string. This page documents its schema so you can hand-write or review a preset instead of relying only on an export.

{% hint style="info" %}
The easiest way to get a valid preset is to build the dashboard in the UI and use **Actions → Export**. Use this page to understand what an exported preset contains, and to edit it safely.
{% endhint %}

For how to build widgets in the UI, see [Creating Dashboards](https://docs.groundcover.com/investigate/dashboards-and-alerts/create-a-dashboard.md). For what each visualization shows, see [Dashboard Visualizations](https://docs.groundcover.com/investigate/dashboards-and-alerts/dashboard-visualizations.md).

## How the preset is validated

* **Unknown fields are rejected.** The preset, widgets, queries, layout entries, time-series configuration (including `yAxis`, `rightYAxis`, `legend`, and thresholds) are strict objects. A misspelled or invented field in them fails validation instead of being ignored.
* **Only `schemaVersion` is required at the top level.** Every other top-level field falls back to an empty or default value when omitted.
* **Layout is normalized for you.** Overlapping layout entries are moved apart, negative `y` values are shifted up, and `minH` is reset to the default for the widget type (see [layout](#layout)).

## Top-level fields

| Field                          | Description                                                                              | Allowed values            |
| ------------------------------ | ---------------------------------------------------------------------------------------- | ------------------------- |
| **schemaVersion** *(required)* | Version of the preset format. Use `8` for new presets.                                   | `8`                       |
| **widgets**                    | All widgets on the dashboard: charts, text notes, and sections. See [widgets](#widgets). | array of widget objects   |
| **layout**                     | Position and size of each widget on the grid. See [layout](#layout).                     | array of layout objects   |
| **duration**                   | Default time range applied when the dashboard opens. See [duration](#duration).          | string                    |
| **variables**                  | Dashboard variables that widgets can reference. See [variables](#variables).             | array of variable objects |
| **spec**                       | Dashboard-wide display settings. See [spec](#spec).                                      | object                    |

{% hint style="info" %}
Presets exported earlier may carry a lower `schemaVersion` (3 to 7) and are still accepted. In versions 3 to 5, `variables` is an object keyed by variable name instead of an array. When you edit an old preset, move it to `schemaVersion: 8` and the array form of `variables`.
{% endhint %}

## duration

The default time range for the dashboard. Set it to the exact label of a predefined range in the time picker:

`Last 1 minute`, `Last 5 minutes`, `Last 15 minutes`, `Last 30 minutes`, `Last hour`, `Last 1.5 hours`, `Last 3 hours`, `Last 6 hours`, `Last 12 hours`, `Last 1 day`, `Last 2 days`, `Last 7 days`, `Last 14 days`, `Last 30 days`

The match is exact and case-sensitive. A value that is not one of these labels is not applied, and the dashboard opens on the time picker's own default instead. Omit the field (or use an empty string) to not set a default.

## spec

| Field                    | Description                                                                                                     | Allowed values        |
| ------------------------ | --------------------------------------------------------------------------------------------------------------- | --------------------- |
| **layoutType**           | Layout mode of the dashboard grid. The UI default is `ordered`.                                                 | `ordered`, `floating` |
| **crosshairSyncEnabled** | When true, hovering one time-series chart shows the crosshair at the same time on the other time-series charts. | boolean               |

## widgets

`widgets` is a flat list. Each entry has a `type` that decides which other fields apply. Every widget needs an `id` that is unique within the dashboard and matches an entry in [layout](#layout).

### Chart widget (`type: "widget"`)

| Field                                | Description                                                                                                                 | Allowed values         |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| **id** *(required)*                  | Unique widget identifier, referenced by `layout`.                                                                           | string                 |
| **type** *(required)*                | Widget kind.                                                                                                                | `widget`               |
| **name** *(required)*                | Title shown on the widget.                                                                                                  | string                 |
| **queries** *(required)*             | One or more queries that feed the widget. At least one is required. See [queries](#queries).                                | array of query objects |
| **visualizationConfig** *(required)* | How the results are drawn. See [visualizationConfig](#visualizationconfig).                                                 | object                 |
| **description**                      | Markdown description shown from the widget's info indicator. Keep it under 1,000 characters, which is what the UI displays. | string                 |

### Text widget (`type: "text"`)

| Field                    | Description                                               | Allowed values |
| ------------------------ | --------------------------------------------------------- | -------------- |
| **id** *(required)*      | Unique widget identifier.                                 | string         |
| **type** *(required)*    | Widget kind.                                              | `text`         |
| **content** *(required)* | Markdown body of the note.                                | string         |
| **color**                | Background color. See [colors](#section-and-text-colors). | color name     |

### Section widget (`type: "section"`)

A section groups widgets under a collapsible header. The widgets inside a section are listed in `widgets` like any other, and are attached to the section through `children` in [layout](#layout).

| Field                 | Description                                                          | Allowed values |
| --------------------- | -------------------------------------------------------------------- | -------------- |
| **id** *(required)*   | Unique widget identifier.                                            | string         |
| **type** *(required)* | Widget kind.                                                         | `section`      |
| **name** *(required)* | Section header.                                                      | string         |
| **description**       | Markdown description of the section.                                 | string         |
| **color**             | Header and background color. See [colors](#section-and-text-colors). | color name     |
| **isCollapsed**       | When true, the section opens collapsed.                              | boolean        |

#### Section and text colors

`none`, `gray`, `amber`, `lime`, `teal`, `sky`, `indigo`, `purple`, `pink`, and the darker variants `slate-dark`, `gray-dark`, `amber-dark`, `lime-dark`, `teal-dark`, `sky-dark`, `indigo-dark`, `purple-dark`, `pink-dark`.

## queries

Each entry in a chart widget's `queries` array describes one query. The compact shape below is what the UI exports.

| Field                     | Description                                                                                                                                                                                                                                                                                                  | Allowed values                                                            |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
| **id** *(required)*       | Identifier of the query within the widget. Formulas refer to other queries by this id, and table rules target a query by it. Examples: `A`, `B`.                                                                                                                                                             | string                                                                    |
| **expr** *(required)*     | The query text. MetricsQL for `metrics`; [gcQL](https://docs.groundcover.com/investigate/querying-your-groundcover-data/groundcover-query-language/groundcover-query-language-gcql-reference.md) for the other data types; an arithmetic expression over other query ids for formulas (for example `A / B`). | string                                                                    |
| **dataType** *(required)* | The data source. Append `-formula` for a formula query. See [dataType](#datatype).                                                                                                                                                                                                                           | see below                                                                 |
| **step**                  | Resolution of the query. Exported presets use `disabled` for queries that return a single value, such as stat, bar, and table widgets, and `null` or omit it to let groundcover choose.                                                                                                                      | string or `null`                                                          |
| **editorMode**            | Whether the query was written in the query builder or the raw editor. Defaults to `builder`.                                                                                                                                                                                                                 | `builder`, `editor`                                                       |
| **alias**                 | Display name for the query's series.                                                                                                                                                                                                                                                                         | string                                                                    |
| **selectedChartColor**    | Series color for this query.                                                                                                                                                                                                                                                                                 | `DEFAULT`, `SEMANTIC`, `RED`, `GREEN`, `BLUE`, `ORANGE`, `GRAY`, `PURPLE` |
| **isHidden**              | When true, the query is hidden from the chart.                                                                                                                                                                                                                                                               | boolean                                                                   |
| **yAxisPosition**         | Which value axis a time-series query is plotted against. Defaults to the left axis. See [rightYAxis](#time-series).                                                                                                                                                                                          | `left`, `right`                                                           |
| **selectedChartType**     | How this query is drawn in a time-series widget. Overrides the widget-level setting.                                                                                                                                                                                                                         | `line`, `stackedBar`, `stackedArea`                                       |
| **limit**                 | Row limit of a formula query. Other queries carry their limit inside `expr`.                                                                                                                                                                                                                                 | integer                                                                   |

### dataType

| Value                                                                                                                                                                                                                   | Data source                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `metrics`                                                                                                                                                                                                               | Metrics, queried with MetricsQL                                                                                                  |
| `logs`, `traces`, `events`                                                                                                                                                                                              | Logs, traces, and events, queried with gcQL                                                                                      |
| `entities`, `issues`, `rum`, `apm`, `ingestion`, `aws_cur`, `dbm_measurements_statement`                                                                                                                                | The other data sources available in the widget builder                                                                           |
| `metrics-formula`, `logs-formula`, `traces-formula`, `events-formula`, `entities-formula`, `issues-formula`, `rum-formula`, `apm-formula`, `ingestion-formula`, `aws_cur-formula`, `dbm_measurements_statement-formula` | A formula over other queries of the widget. The value is the `-formula` counterpart of the data source the formula computes over |

A formula is an ordinary query entry whose `expr` references other query ids. It has no data source of its own: it follows the queries it references, and its `dataType` records that source with a `-formula` suffix. A widget holds at most one formula. See [Dashboard Visualizations](https://docs.groundcover.com/investigate/dashboards-and-alerts/dashboard-visualizations.md#multiple-queries-in-one-widget) for how formulas behave in the UI. For example, with queries `A` and `B` on `metrics`, this entry plots their ratio:

```json
{ "id": "formula-A", "expr": "A / B", "dataType": "metrics-formula", "editorMode": "builder" }
```

{% hint style="info" %}
A `data` widget only accepts `logs`, `traces`, and `events` queries in builder mode, and uses a single query. See [Dashboard Visualizations](https://docs.groundcover.com/investigate/dashboards-and-alerts/dashboard-visualizations.md) for which data types work with which visualization.
{% endhint %}

## visualizationConfig

`visualizationConfig.type` selects the visualization and decides which other fields are allowed.

| `type`        | Visualization                                          |
| ------------- | ------------------------------------------------------ |
| `time-series` | Line, stacked bar, or stacked area chart over time     |
| `stat`        | Single value, optionally colored by rules              |
| `table`       | Tabular results                                        |
| `bar`         | Ranked bars (the **Top list** visualization in the UI) |
| `pie`         | Pie chart                                              |
| `treemap`     | Treemap                                                |
| `data`        | Raw log, trace, or event rows                          |

Fields shared by several types:

| Field                  | Applies to                                  | Description                                                                       | Allowed values                                                            |
| ---------------------- | ------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **type** *(required)*  | all                                         | Visualization type.                                                               | see above                                                                 |
| **step**               | all                                         | Widget-level step.                                                                | string                                                                    |
| **selectedUnit**       | time-series, stat, table, bar, pie, treemap | Unit used to format values. See [units](#units).                                  | unit name                                                                 |
| **customUnitLabel**    | time-series, stat, table, bar, pie, treemap | Free-text unit label shown next to values.                                        | string                                                                    |
| **selectedChartColor** | time-series, bar, pie                       | Palette used for the series.                                                      | `DEFAULT`, `SEMANTIC`, `RED`, `GREEN`, `BLUE`, `ORANGE`, `GRAY`, `PURPLE` |
| **displayLabel**       | time-series, bar, pie, treemap              | When grouping by several labels, show only this label's value as the series name. | string                                                                    |

For a treemap, `selectedChartColor` accepts only `DEFAULT` and `SEMANTIC`.

### time-series

| Field                          | Description                                                                                                                                                                                                                  | Allowed values                                                            |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **selectedChartType**          | Default mark for the widget's queries.                                                                                                                                                                                       | `line`, `stackedBar`, `stackedArea`                                       |
| **selectedChartColorOverride** | Per-query palette override that survives widget-level color changes.                                                                                                                                                         | `DEFAULT`, `SEMANTIC`, `RED`, `GREEN`, `BLUE`, `ORANGE`, `GRAY`, `PURPLE` |
| **yAxis**                      | Left value axis framing. See [Axis fields](#axis-fields).                                                                                                                                                                    | object                                                                    |
| **rightYAxis**                 | Optional right value axis for queries with `yAxisPosition: "right"`. Takes the [axis fields](#axis-fields) plus its own `selectedUnit` and `customUnitLabel`. The widget-level `selectedUnit` applies to the left axis only. | object                                                                    |
| **missingBuckets**             | How buckets without data are drawn.                                                                                                                                                                                          | `nulls`, `zeros`                                                          |
| **legend**                     | Legend settings. See [legend](#legend).                                                                                                                                                                                      | object                                                                    |
| **thresholds**                 | Reference lines or bands drawn on the chart. Up to 10. See [thresholds](#thresholds).                                                                                                                                        | array of threshold objects                                                |

#### Axis fields

| Field         | Description                     | Allowed values    |
| ------------- | ------------------------------- | ----------------- |
| **zero**      | Force the axis to include zero. | boolean or `null` |
| **min**       | Fixed lower bound.              | number or `null`  |
| **max**       | Fixed upper bound.              | number or `null`  |
| **scale**     | Axis scale.                     | `linear`, `log`   |
| **showLabel** | Show the axis label.            | boolean or `null` |

#### legend

| Field       | Description                                                        | Allowed values                               |
| ----------- | ------------------------------------------------------------------ | -------------------------------------------- |
| **display** | `none` hides the legend.                                           | `none`, `bottom`                             |
| **type**    | `compact` shows inline chips; `table` shows per-series statistics. | `compact`, `table`                           |
| **columns** | Statistic columns shown by the `table` legend.                     | array of `avg`, `min`, `max`, `sum`, `value` |

#### thresholds

A threshold draws a reference on a time-series chart. Each entry is either a `line` at one value or a `range` band.

| Field                             | Description                                                                | Allowed values                   |
| --------------------------------- | -------------------------------------------------------------------------- | -------------------------------- |
| **type** *(required)*             | Line at one value, or a band between two.                                  | `line`, `range`                  |
| **variant** *(required)*          | Semantic color.                                                            | `error`, `warning`, `ok`, `info` |
| **style** *(required)*            | Stroke style.                                                              | `dashed`, `solid`                |
| **visible** *(required)*          | Whether the threshold is drawn.                                            | boolean                          |
| **showLabel** *(required)*        | Whether the label is drawn.                                                | boolean                          |
| **label**                         | Label text.                                                                | string                           |
| **id**                            | Optional identifier.                                                       | string                           |
| **value** *(required for `line`)* | Where the line is drawn, in the axis unit.                                 | number                           |
| **min**, **max**                  | Bounds of a `range`. Either may be omitted or `null` for a one-sided band. | number or `null`                 |

### stat

| Field                     | Description                                                                        | Allowed values            |
| ------------------------- | ---------------------------------------------------------------------------------- | ------------------------- |
| **decimals**              | Fraction digits of the displayed value, or `full` for the unrounded value.         | integer 0 to 4, or `full` |
| **conditionalFormatting** | Rules that color the value. See [Conditional formatting](#conditional-formatting). | array of rules, up to 10  |

### table

| Field                     | Description                                                                                                               | Allowed values           |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| **columnOrder**           | Column names in display order.                                                                                            | array of strings         |
| **columnWidths**          | Column width by column name.                                                                                              | `map<string,number>`     |
| **pinnedColumns**         | Columns pinned to either side: `{ "left": [...], "right": [...] }`.                                                       | object                   |
| **sortModel**             | Default sort: `{ "field": "<column>", "sort": "asc" \| "desc" }`. Add `query` to sort on a specific query's value column. | object                   |
| **unitOverrides**         | Per-column units: array of `{ "query": "<query id>", "field": "<value field>", "unit": "<unit>" }`. `field` is optional.  | array of objects         |
| **conditionalFormatting** | Like stat rules, but each rule also names the `query` (and optionally the `field`) whose column it colors.                | array of rules, up to 10 |

A table also accepts `columnUnits`, a map from column display name to unit, which is kept for presets saved before `unitOverrides` existed. Prefer `unitOverrides` in new presets.

### data

| Field         | Description                                                       | Allowed values |
| ------------- | ----------------------------------------------------------------- | -------------- |
| **sortModel** | Default sort: `{ "field": "<column>", "sort": "asc" \| "desc" }`. | object         |

### Conditional formatting

Rules color a stat value, or a table column, when the value matches a numeric condition. Rules are evaluated from top to bottom and the **first match wins**, so order them from most to least specific. A rule that overlaps one above it is ignored. At most 10 rules are allowed.

| Field                              | Description                                                                                                       | Allowed values                                                                                         |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **condition** *(required)*         | Comparison applied to the value.                                                                                  | `greater-than`, `greater-than-or-equal`, `less-than`, `less-than-or-equal`, `equal-to`, `within-range` |
| **value** *(required)*             | The number to compare against. For `within-range`, the lower bound.                                               | number                                                                                                 |
| **maxValue**                       | Inclusive upper bound. Required when `condition` is `within-range`, and must be greater than or equal to `value`. | number                                                                                                 |
| **color** *(required)*             | Color applied on a match.                                                                                         | `green-text`, `yellow-text`, `red-text`, `green-background`, `yellow-background`, `red-background`     |
| **query** *(table only, required)* | Id of the query whose column the rule applies to.                                                                 | string                                                                                                 |
| **field** *(table only)*           | Value field within that query.                                                                                    | string                                                                                                 |

### Units

`selectedUnit` accepts one of these values, written exactly as shown:

| Category       | Values                                                                                                          |
| -------------- | --------------------------------------------------------------------------------------------------------------- |
| Data size      | `Bytes`, `KB`, `MB`, `GB`, `TB`, `PB`, `EB`, `ZB`, `YB`, `KiB`, `MiB`, `GiB`, `TiB`, `PiB`, `EiB`, `ZiB`, `YiB` |
| Data rate      | `Bytes/sec`, `Bits/sec`, `KB/s`                                                                                 |
| Time           | `ps`, `ns`, `µs`, `ms`, `Seconds`, `min`, `h`, `d`, `mo`, `y`                                                   |
| CPU            | `CPU`, `mCPU`                                                                                                   |
| Ratio          | `%`, `Percentage`                                                                                               |
| Count and rate | `Number`, `Raw`, `Req/s`, `Operations/sec`                                                                      |
| Currency       | `$`                                                                                                             |

## layout

`layout` places each widget on a grid that is **24 columns** wide. Give every widget in `widgets` an entry.

| Field               | Description                                                                                                                      | Allowed values                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| **id** *(required)* | Id of the widget this entry positions.                                                                                           | string                                            |
| **x**               | Column of the left edge, counted from `0`.                                                                                       | number                                            |
| **y**               | Row of the top edge.                                                                                                             | number                                            |
| **w**               | Width in columns, out of 24.                                                                                                     | number                                            |
| **h**               | Height in rows.                                                                                                                  | number                                            |
| **minH**            | Minimum height in rows. Reset to the default for the widget type: `8` for chart widgets, `4` for text widgets, `2` for sections. | number                                            |
| **minW**            | Minimum width in columns.                                                                                                        | number                                            |
| **children**        | Layout entries of the widgets inside a section. Only meaningful on a section's entry.                                            | array of layout objects (same fields, no nesting) |

Children of a section are positioned relative to the section, and exported dashboards start them at `y: 2`, below the section header. Size the section's own `h` so that it contains its children. List a widget either at the top level of `layout` or as a child of a section, not both.

## variables

Variables let one value, such as a cluster, filter many widgets. Each entry has a `kind`:

* `list` (dynamic): the options are fetched from a data source.
* `static_list`: the options are a list you write.

See [Variables](https://docs.groundcover.com/investigate/dashboards-and-alerts/create-a-dashboard.md#variables) for how they behave in the UI.

### Dynamic variable (`kind: "list"`)

| Field                                                 | Description                                                                                                                                                                                                  | Allowed values                                                                                         |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| **kind** *(required)*                                 | Variable kind.                                                                                                                                                                                               | `list`                                                                                                 |
| **spec.variableName** *(required)*                    | Name used to reference the variable in queries, without the `$`.                                                                                                                                             | string                                                                                                 |
| **spec.datasource** *(required)*                      | Where option values are fetched from.                                                                                                                                                                        | object                                                                                                 |
| **spec.datasource.kind** *(required)*                 | Data source. Use `*` to look the key up across all data sources.                                                                                                                                             | `metrics`, `logs`, `traces`, `events`, `entities`, `issues`, `rum`, `apm`, `ingestion`, `aws_cur`, `*` |
| **spec.datasource.key** *(required)*                  | Label or attribute key whose values become the options.                                                                                                                                                      | string                                                                                                 |
| **spec.datasource.metric** *(required for `metrics`)* | Metric that is queried for the key's values.                                                                                                                                                                 | string                                                                                                 |
| **spec.values.default** *(required)*                  | Values selected when the dashboard opens. Use `["*"]` to select all.                                                                                                                                         | array of strings                                                                                       |
| **spec.overrides**                                    | Key overrides: when the variable is used against a given data source, it resolves to a different key. Each entry is `{ "datasource": "<kind>", "key": "<key>" }`, where `datasource` is any kind except `*`. | array of objects                                                                                       |

### Static variable (`kind: "static_list"`)

| Field                                | Description                                                                                                                                               | Allowed values   |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| **kind** *(required)*                | Variable kind.                                                                                                                                            | `static_list`    |
| **spec.variableName** *(required)*   | Name used to reference the variable in queries, without the `$`.                                                                                          | string           |
| **spec.key** *(required)*            | The real label or attribute key the variable filters on. It can differ from the name, so a long key like `k8s.namespace.name` can be referenced as `$ns`. | string           |
| **spec.values.custom** *(required)*  | The options offered by the variable. The UI allows up to 100.                                                                                             | array of strings |
| **spec.values.default** *(required)* | Values selected when the dashboard opens.                                                                                                                 | array of strings |

### Referencing variables

In a MetricsQL query, reference a variable inside a label matcher with the regex operator, so that selecting several values, or all of them, works:

```
groundcover_pvc_usage_percent{cluster=~"$cluster", namespace=~"$namespace"}
```

In a query-builder filter, the bare `$name` form expands to a whole filter atom, and `$name.value` expands to just the selected values. See [Using a Variable](https://docs.groundcover.com/investigate/dashboards-and-alerts/create-a-dashboard.md#using-a-variable).

Three system variables are always available, and are not declared in `variables`:

| Variable    | Resolves to                       |
| ----------- | --------------------------------- |
| `$interval` | The chart step                    |
| `$range`    | The time picker range             |
| `$range_s`  | The time picker range, in seconds |

For example, `sum(increase(groundcover_kube_pod_container_status_restarts_total{cluster=~"$cluster"}[$range]))` counts restarts over whatever range the dashboard is showing.

## Complete example

The resource below defines a dashboard with two dynamic variables, a note, a section that contains two widgets, a stat widget with conditional formatting, and a time-series widget with a threshold. It uses `jsonencode` so you can write the preset as native Terraform instead of an escaped string.

```hcl
resource "groundcover_dashboard" "cluster_storage" {
  name        = "Cluster Storage and CPU"
  description = "Volume usage and container CPU, filtered by cluster and namespace"

  preset = jsonencode({
    schemaVersion = 8
    duration      = "Last hour"
    variables = [
      {
        kind = "list"
        spec = {
          variableName = "cluster"
          datasource = {
            kind   = "metrics"
            metric = "groundcover_kube_pod_status_phase"
            key    = "cluster"
          }
          values = {
            default = ["*"]
          }
        }
      },
      {
        kind = "list"
        spec = {
          variableName = "namespace"
          datasource = {
            kind   = "metrics"
            metric = "groundcover_kube_pod_status_phase"
            key    = "namespace"
          }
          values = {
            default = ["*"]
          }
        }
      },
    ]
    widgets = [
      {
        id          = "sec-storage"
        type        = "section"
        name        = "Storage and CPU"
        color       = "sky"
        description = "Volume capacity and container CPU, filtered by the cluster and namespace variables."
        isCollapsed = false
      },
      {
        id          = "stat-pvc"
        type        = "widget"
        name        = "Fullest volume"
        description = "Highest PVC usage across the selected clusters and namespaces."
        queries = [
          {
            id         = "A"
            expr       = "max(groundcover_pvc_usage_percent{cluster=~\"$cluster\", namespace=~\"$namespace\"})"
            dataType   = "metrics"
            step       = "disabled"
            editorMode = "builder"
            alias      = "worst volume"
          },
        ]
        visualizationConfig = {
          type         = "stat"
          selectedUnit = "Percentage"
          decimals     = 1
          conditionalFormatting = [
            {
              condition = "greater-than-or-equal"
              value     = 90
              color     = "red-background"
            },
            {
              condition = "greater-than-or-equal"
              value     = 80
              color     = "yellow-background"
            },
            {
              condition = "less-than"
              value     = 80
              color     = "green-background"
            },
          ]
        }
      },
      {
        id   = "ts-cpu"
        type = "widget"
        name = "CPU usage by workload"
        queries = [
          {
            id         = "A"
            expr       = "topk_avg(10, sum by (workload, namespace) (groundcover_container_cpu_usage_rate_millis{cluster=~\"$cluster\", namespace=~\"$namespace\"}))"
            dataType   = "metrics"
            step       = null
            editorMode = "builder"
          },
        ]
        visualizationConfig = {
          type              = "time-series"
          selectedChartType = "line"
          selectedUnit      = "mCPU"
          legend = {
            display = "bottom"
            type    = "table"
            columns = ["avg", "max"]
          }
          thresholds = [
            {
              type      = "line"
              value     = 1000
              variant   = "warning"
              style     = "dashed"
              visible   = true
              showLabel = true
              label     = "1 CPU"
            },
          ]
        }
      },
      {
        id      = "txt-notes"
        type    = "text"
        content = "**Runbook:** if the fullest volume is red, see the storage runbook."
        color   = "amber"
      },
    ]
    layout = [
      {
        id   = "txt-notes"
        x    = 0
        y    = 0
        w    = 24
        h    = 4
        minH = 4
      },
      {
        id   = "sec-storage"
        x    = 0
        y    = 4
        w    = 24
        h    = 20
        minH = 2
        children = [
          {
            id   = "stat-pvc"
            x    = 0
            y    = 2
            w    = 6
            h    = 8
            minH = 8
          },
          {
            id   = "ts-cpu"
            x    = 6
            y    = 2
            w    = 18
            h    = 16
            minH = 8
          },
        ]
      },
    ]
    spec = {
      layoutType           = "ordered"
      crosshairSyncEnabled = true
    }
  })
}
```

{% hint style="warning" %}
Because unknown fields are rejected, a typo in a field name makes `terraform apply` fail rather than silently dropping the setting. If a preset is rejected, compare the field names with the tables on this page.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/investigate/dashboards-and-alerts/dashboard-schema.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
