Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for Grafana Difficulty: Beginner ClaudeChatGPT

Grafana Value Mappings and Thresholds Prompt

Configure Grafana value mappings, thresholds, and color schemes so panels turn raw numbers into clear, consistent status signals.

Target user
Dashboard authors improving readability and status signaling
Difficulty
Beginner
Tools
Claude, ChatGPT

The prompt

You are a senior observability engineer who makes Grafana panels readable with value mappings, thresholds, and color schemes so a glance conveys status.

I will provide:
- The metric and its raw values (numbers, enum codes, states)
- The panel type (stat, gauge, table, timeseries, state timeline)
- The status semantics (what is good/warn/bad)

Your job:

1. **Value mappings**: map raw values to labels/colors — `value` maps (exact), `range` maps (numeric bands), `regex` maps (pattern), and `special` maps (null/NaN/empty). Turn `0/1/2` into `Down/Degraded/Up`.
2. **Thresholds**: define `thresholds.steps` in `fieldConfig.defaults` with `absolute` or `percentage` mode; each step sets a color from its `value` upward.
3. **Color mode**: choose thresholds-based coloring, `Color scheme` (continuous green-yellow-red), or by series; set `fieldConfig.defaults.color.mode`.
4. **Units + decimals**: set `unit` (e.g. `percent`, `bytes`, `reqps`, `ms`) and `decimals` so mapped values render correctly.
5. **Panel binding**: for stat/gauge, use `Value` or `Background` color mode; for tables, apply color to cell background/text via cell display mode; for state timeline, mappings drive the state colors.
6. **Consistency**: reuse the same threshold palette (green/orange/red) org-wide; centralize via library panels where possible.
7. **Overrides**: apply field overrides so one series (e.g. `latency_p99`) gets stricter thresholds than others.
8. **Accessibility**: don't rely on color alone; keep the mapped text label so colorblind users still read status.

Mark DESTRUCTIVE: none — these are display-only settings. Flag misleading thresholds that could hide a real problem (e.g. red band set above an already-critical value).

---

Metric + raw values: [DESCRIBE]
Panel type: [DESCRIBE]
Status semantics: [DESCRIBE]

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Why this prompt works

Value mappings, thresholds, and color are where a dashboard becomes glanceable — or misleading. Grafana offers four mapping types and two threshold modes, and mixing them up (percentage vs absolute, or an unmapped state) produces panels that look fine while hiding failure. This prompt pins the mapping type, threshold mode, and units, and insists on text labels for accessibility.

How to use it

  1. List every possible raw value so no state goes unmapped.
  2. State the good/warn/bad semantics so thresholds match reality.
  3. Confirm the unit so thresholds fire at the right magnitude.
  4. Standardize the palette across the dashboard set.

Useful commands

# Inspect a panel's fieldConfig (mappings + thresholds)
curl -s -H "Authorization: Bearer $TOKEN" \
  http://localhost:3000/api/dashboards/uid/svc-health \
  | jq '.dashboard.panels[] | {title, mappings: .fieldConfig.defaults.mappings, thresholds: .fieldConfig.defaults.thresholds}'

Example config

Stat panel with value mappings and absolute thresholds:

{
  "type": "stat",
  "title": "Service State",
  "fieldConfig": {
    "defaults": {
      "unit": "short",
      "color": { "mode": "thresholds" },
      "mappings": [
        { "type": "value", "options": {
          "0": { "text": "Down",     "color": "red",    "index": 0 },
          "1": { "text": "Degraded", "color": "orange", "index": 1 },
          "2": { "text": "Up",       "color": "green",  "index": 2 } } },
        { "type": "special", "options": {
          "match": "null", "result": { "text": "No Data", "color": "purple", "index": 3 } } }
      ],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          { "color": "red",    "value": null },
          { "color": "orange", "value": 1 },
          { "color": "green",  "value": 2 }
        ]
      }
    }
  },
  "options": { "colorMode": "background", "textMode": "value_and_name" }
}

Common findings this catches

  • Green while failing → thresholds too loose.
  • Inverted colorspercentage vs absolute mismatch.
  • Uncolored cells → an actual state left unmapped.
  • Wrong trigger point → unit mismatch (ms vs s, bytes vs bits).
  • Hidden gaps → null mapped to a benign label.
  • Inaccessible → color used without a text label.

When to escalate

  • Org-wide status palette and semantics — observability/design lead.
  • Thresholds that should be derived from SLOs — service owner.
  • Accessibility standards for dashboards — design system owner.

Related prompts

More Grafana prompts & error guides

Browse every Grafana prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.