kubesense-dashboards
Create and edit KubeSense dashboards over metrics, logs, traces, real user monitoring (RUM) and infrastructure host maps — directly with the create-dashboard and update-dashboard MCP tools, or as preset JSON the user imports — with the exact schema, the fields that hard-fail import, and the fields that silently discard your data instead of erroring. Includes validate-dashboard-json for checking a preset before you commit to it.
How do I install this agent skill?
npx skills add https://github.com/kubesense-ai/kubesense-mcp-skills --skill kubesense-dashboardsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides comprehensive instructions for creating and validating KubeSense dashboard JSON presets using MCP tools. It focuses on technical schema requirements and best practices for telemetry data discovery. No malicious code, prompt injection, or data exfiltration patterns were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
KubeSense Dashboards
Build a dashboard preset — the same shape the Export button produces, so an exported dashboard can be edited and re-imported.
Two ways to deliver it:
create-dashboard MCP tool | Preset JSON | |
|---|---|---|
| Applied by | the agent (write tool, needs approval) | the user, via Dashboards → Import |
| Use when | the user asked you to create one | they asked for the JSON, or want to review first |
| Shape to emit | the preset object itself | the import envelope, with preset stringified |
Both go through the same server-side schema check, so a preset that passes
validate-dashboard-json is one that both paths accept.
When to Use
- "Create a dashboard for…" / "Build a dashboard with panels for…" →
create-dashboard - "Give me the dashboard JSON for…" → preset JSON
- "Generate a dashboard preset" → preset JSON
- "What does the X panel show" / "show me the X panel on the Y dashboard" →
list-dashboardsfor the id, thenrun-dashboard-panelwith the panel's name. It runs the saved queries with the dashboard's variables and the panel's time frame applied. - "Change / fix / add a panel to the X dashboard" →
get-dashboard-details, thenupdate-dashboard— see Editing an existing dashboard
Always Validate Before You Finish
Call validate-dashboard-json on the preset before creating it or handing it over.
It stores nothing, so call it as often as you need.
# valid=false findings=2
path rule message
/panels/0/queries/0/selectedMode shape value must be one of 'logs', 'metrics', 'traces', 'events', 'rum', 'formula'
/gridLayout/0 shape must have required property 'h'
Each path is a JSON Pointer to the exact value to fix. Repeat until valid=true.
Pass the preset object as document — not the import envelope with the stringified
preset field. Same for create-dashboard's preset argument.
Validation checks shape, not whether the data exists. A query against a metric nobody collects is well-formed and will render empty, so discover names first.
Discover Fields First
If the KubeSense MCP server is connected, discover real names before writing queries — never guess a metric, group-by, or filter field.
| To find | Tool |
|---|---|
| Metric names | get-available-metrics |
Metric labels (for by) | get-metric-labels |
| Log, trace, event or RUM fields | get-fields with signal (rum_view, … for RUM) |
Dashboard queries use storage-level field names, not the MCP catalog labels — the webapp posts these directly. Take field names from the discovery output's storage column where they differ, and tell the user to confirm on the panel preview. See kubesense-mcp for the label/storage distinction.
Without MCP, fall back to user-provided names and say they need verifying.
Output Format
{
"name": "<dashboard name>",
"description": "",
"preset": "<stringified JSON of the preset object>"
}
[!IMPORTANT] In this envelope,
presetis a JSON string, not a nested object. The validator declarespreset: z.string()and only runs the preset schema afterJSON.parse(preset). Emitting an object fails with "Preset must be a valid JSON string that matches the dashboard preset schema".This applies to the import envelope only.
create-dashboardandvalidate-dashboard-jsontake the preset object itself — passing a stringified blob to them works too, but do not wrap it in this envelope.
name is required and non-empty. description is optional.
The object you stringify:
{
"gridLayout": [],
"panels": [],
"variables": [],
"subGrids": [],
"subGridLayout": []
}
Only gridLayout and panels are required; the rest default to []. Three more optional
keys validate: publicDashboardPath (string), eventOverlays (see
Event Overlays) and tabs (see Tabs).
Minimal Valid Dashboard
Verified against the live validator:
{
"name": "Minimal",
"description": "",
"preset": "{\"gridLayout\":[{\"i\":\"0\",\"x\":0,\"y\":0,\"w\":12,\"h\":4}],\"panels\":[{\"name\":\"Up\",\"panelType\":\"timeSeries\",\"queries\":[{\"selectedMode\":\"metrics\",\"label\":\"A\",\"selectedMetric\":\"up\",\"functions\":[]}],\"config\":{}}],\"variables\":[],\"subGrids\":[],\"subGridLayout\":[]}"
}
What Hard-Fails Import
Get these wrong and import is rejected with an error:
presetnot a string.- Missing or empty top-level
name. - Missing
gridLayoutorpanels. - A
gridLayoutitem missing any ofi,x,y,w,h, or with a wrong type ("6"instead of6). - A panel with no queries (
queriesmissing or[]) is refused byvalidate-dashboard-json,create-dashboardandupdate-dashboard(rulepanel_has_queries) — it would open on an empty query builder and "No data". A dashboard with no panels at all is fine. - A panel missing
name. (An emptyname: ""is accepted — the editor allows it and stored dashboards carry it — but a nameless panel is unusable, so always set one.) - A panel missing the
querieskey entirely (an empty array parses, but is refused by the rule in item 5). - A query whose
selectedModeis notmetrics|logs|traces|events|rum|formula|infrastructure. A RUM signal name from the MCP tools (rum_view) is not aselectedModehere; see RUM query. - A logs/traces/events/rum query missing
columnFields— the single hard-required field on those queries. Arumquery also needsrumEventType. - A
columnFields[]entry withfield: "". - A formula missing
expression, or one containing lowercase letters or a decimal point. - A formula referencing an undefined label, referencing itself, placed before the queries it references, or with a multi-character label.
- A host map whose levels break host > pod > container, use a signal their entity lacks,
size an outer level, group by something the first level does not carry, or filter on a
field host maps cannot narrow by (rules
infrastructure_*andhost_map_query) — see references/host-map.md. - A
tabs[].idthat does not match^[a-z0-9][a-z0-9-]{0,39}$, or that repeats another tab's id. - A
tabs[].titlethat is empty after trimming, longer than 50 characters, or equal to another tab's title compared case-insensitively after trimming. - A non-empty
tabsarray alongside a non-empty top-levelpanels,gridLayout,subGridsorsubGridLayout. A tabbed dashboard keeps those four empty. - Two sub-grids with the same
idanywhere in the dashboard, across all tabs. - A tab whose
gridLayouthas a different number of entries than itspanels(ruletab_grid_layout). Unlike the top level, a tab's layout must match exactly.
What Silently Destroys Your Data
More dangerous than hard failures — these validate cleanly and then discard what you sent.
Almost every field carries a .catch(), so a single bad value resets its whole array or
object to the default.
| Field | On a bad value |
|---|---|
functions (metrics query) | The entire array is wiped to [] — one malformed entry loses every function |
variables | All variables deleted — one invalid variable empties the array |
subGrids | All sub-grids dropped |
subGrids[].panels | That row's panels emptied |
aggregation | Resets to {"function": "row_count"} |
panelType | Resets to "timeSeries" |
chart_type | Resets to "table" |
yAxisLabelFormatter | Resets to "auto" |
colorScheme | Resets to {"type":"palette","palette":"default"} |
step | Non-integer (e.g. 60.5) resets to "auto" |
pagination | page_size > 500 resets the whole object to {page:1,page_size:50} |
Because of this, prefer omitting an optional field over guessing its value — an omitted field takes the default; a wrong one can take out its siblings.
[!WARNING]
gridLayoutmust have at least as many entries aspanels. Panels and layout are matched positionally by array index, not by theivalue. A short top-levelgridLayoutthrows a TypeError when the dashboard renders.validate-dashboard-jsonandcreate-dashboardrefuse it (rulegrid_layout_covers_panels); a server built before that rule accepts it, so still check the count. Sub-grid layouts may be shorter. Theistring is only used to identify sub-grid rows (via asg-prefix); real exports set it to the index ("0","1", …).
Panel
{
"name": "CPU by namespace",
"description": "",
"panelType": "timeSeries",
"queries": [],
"config": {}
}
panelType — 13 values: timeSeries, stat, table, list, bar, pie, topList,
treemap, alert, spl, sql, slo, hostMap. Note camelCase timeSeries.
config can never fail import (the whole object catches), so {} is always safe and
inherits every default. For the full field list, defaults, and the colorScheme /
thresholds / alignColumns / columnFormatting / visualFormattingRules shapes, read
references/panel-config.md.
For a table panel, per-column display names, visibility, cell type (number / bar),
and threshold/range colouring go in config.columnFormatting[] — see the reference.
For a top-list panel, config.topListDisplayMode is flat (default) or stacked, and
stacked needs two or more groupBy entries — the first is the row, the rest are the
blocks stacked inside it. With one dimension the renderer draws flat whatever the field
says. Value-driven colouring goes in config.visualFormattingRules[], which supersedes
thresholds for this panel type. Both are in the reference.
For a treemap panel, give the query a groupBy and leave config alone — it has no
config of its own beyond colorScheme and the unit, and it draws one cell per returned
series, sized by value and coloured categorically from the panel palette. It is an instant
panel like pie/topList, so config.step does not apply. Its chart_type is topList
(see below), since the query-level enum has no treemap arm. Every series comes back, so
cap the result with the query's own limit rather than expecting the panel to trim it.
For an alert panel, the query names a rule and the widget to draw it as:
widgetType is graph, value or summary. graph and value need a ruleId
(and cache the rule's name in ruleName); graph also takes vizType, timeseries
(default) or topList, which draws the rule's own query ranked by each series' last
value. value prints that rule's current figure alone — for a rule firing on several
series it is the one furthest past the threshold, highest for a greater_than rule and
lowest for a less_than one. summary reads filters instead, plus
displayFormat (count/list/both), colorPreference (text/background) and
summaryType (monitor/group/combined). summaryType decides what one row is:
monitor one per rule, group one per firing instance (a rule grouped by pod gets a
row per breaching pod), combined one per rule with its firing instances counted beside
it. Unlike Datadog's equivalent, group cannot list healthy groups — the engine
materialises an instance only while it is firing, so a series that never breached has no
row to show.
Like slo it is served by the alert endpoints, not /explore/query, so config.step
does not apply and its chart_type is topList. Datadog's fourth widget, Check
Status, has no arm: the engine persists only normal and firing, so a four-state
widget would have nothing to put in two of its cells.
For a host map panel (hostMap), hosts are tiles with their pods and containers nested
inside, each coloured by a signal such as CPU utilization or readiness. It takes exactly
one infrastructure query and no PromQL; the server compiles it for Kubernetes and legacy
hosts alike. Colours go in config.hostMapColors, keyed by entity. Levels, signals,
grouping, filters and colours are in
references/host-map.md.
A panel follows the dashboard's time picker unless config.timeFrame gives it its own
relative window: last_5m … last_30d, week_to_date, month_to_date, previous_week,
previous_month (weeks Monday to Sunday, in the viewer's timezone). Use it only where the
period is the point, such as a month-to-date cost stat beside hourly charts, and omit it
everywhere else. Keys and exact boundaries are in
references/panel-config.md.
Three config fields the old format got wrong:
thresholdDisplayMode, notenableThresholds. Values:off(default),lines,lines_dashed,filled_regions,filled_regions_and_lines,filled_regions_and_lines_dashed.colorScheme, notcolorPalette. A 5-variant union; the palette variant is{"type":"palette","palette":"default"}and the only palette keys aredefault,success,warning,error. To pin one query's colour regardless of the panel scheme, use the query's ownfieldConfig.color(see Per-query color).mergeTablesisz.literal(true)and lives in the defaults — it is alwaystrueand cannot be disabled. Sendingfalsesilently becomestrue. Just omit it.
Y-axis units
yAxisLabelFormatter accepts 199 values — the same enum as fieldConfig.unit. Common
ones: auto, number, percentage, bytes, bytes/sec, nanoseconds, milliseconds,
seconds, mCPU, CPU. Use nanoseconds for any panel aggregating trace duration —
the formatter auto-scales ns → µs/ms/s. Full list in
references/panel-config.md.
[!WARNING]
percent,percent_unit,short,ops,bps,celsius,fahrenheit, andnonedo not exist and silently becomeauto. Usepercentage,CPU/mCPU,bytes/sec,numberinstead.
Queries
Discriminated on selectedMode: metrics | logs | traces | events | rum | formula |
infrastructure (host maps only, see references/host-map.md). Note spl is
not a valid selectedMode — use panelType: "spl" with a logs/traces query and
filterMode: "SPL".
Metrics query
{
"selectedMode": "metrics",
"label": "A",
"selectedMetric": "container_cpu_usage_seconds_total",
"functions": [],
"filters": {},
"queryMode": "builder",
"promql": "",
"visible": true,
"labelOptions": { "type": "auto" },
"pagination": { "page": 1, "page_size": 50 },
"fieldConfig": {}
}
Every field is optional. queryMode is builder or code — use code with promql
set, builder with selectedMetric + functions.
A builder query can also shift its series selector with selectorModifiers:
{"offset": "1h"}, {"at": "end()"} (start(), end() or a unix timestamp), or both.
The Explorer renders them where the selector is used, e.g. rate(m{…}[5m] offset 1h).
variables is auto-derived from filters and promql ($name references) — anything you
supply is overwritten. Don't bother setting it.
Logs / traces query
{
"selectedMode": "logs",
"label": "A",
"columnFields": [],
"filters": {},
"queryMode": "builder",
"filterMode": "MFD",
"aggregation": { "function": "row_count" },
"groupBy": [],
"chart_type": "table",
"visible": true,
"sorting": {
"sortBy": { "field": "", "type": "string", "is_attribute": false },
"sortOrder": "ASC"
},
"query": "",
"pagination": { "page": 1, "page_size": 50 },
"fieldConfig": {}
}
[!IMPORTANT]
columnFieldsis required — include it on every logs/traces query, even as[]. Omitting it is a hard import failure. Entry shape:{"field": "namespace", "type": "string", "is_attribute": false}with optionalaliasandlabel.fieldmust be non-empty.
chart_type— 7 values:table,stat,bar,pie,topList,timeseries,list. Lowercasetimeseries—timeSeriessilently becomestable. This is a query-level field, separate from the panel-levelpanelType. There is deliberately notreemaparm: the panel is not offered for SPL/SQL, so atreemappanel setschart_typetotopListthe way astatpanel setstable.filterMode—MFD,ADVANCED_QUERY,SPL,SQL. UseADVANCED_QUERYfor anything MFD's equality-only filters can't express (e.g. a latency threshold). See Filtering a logs / traces / events / rum query below: the WHERE clause goes infilters.advanced_query, never inquery.groupByentries use the same shape ascolumnFields.list(array) andvalue(string) are the SPL/SQL column fields. There is notopListLabel/topListValue.
aggregation is strict about type:
{ "function": "p99", "fields": [ { "field": "duration", "type": "float", "is_attribute": false } ] }
row_count— nofields.unique_count—fieldsrequired,typeis"float"or"string".avg,sum,max,min,p99,p95,p90,p75,p50—fieldsrequired andtypemust be literally"float".
Get any of that wrong — missing fields, type: "string" on a numeric aggregation, or
function: "count" (not a valid name) — and the whole aggregation silently resets to
row_count, giving you a row count where you asked for a percentile.
Filtering a logs / traces / events / rum query
A WHERE clause is stored in the filter store, not in query:
{
"selectedMode": "traces",
"label": "A",
"columnFields": [],
"filterMode": "ADVANCED_QUERY",
"filters": { "advanced_query": ["service = checkout AND duration > 500"] },
"aggregation": { "function": "row_count" }
}
filters.advanced_queryis an array holding one WHERE string.filterMode: "ADVANCED_QUERY"makes the panel open in the Advanced editor.- The WHERE syntax is the one the search/analyze tools accept:
=,!=,<,>,<=,>=,LIKE,ILIKE,IN (...), combined withAND,ORand a prefixNOT: exclude a list asNOT namespace IN (a, b), nevernamespace NOT IN (a, b). Field names are the catalog labels fromget-fields(samesignal); prefix an attribute with@(@http.route = /api/orders). queryis only for SPL or SQL text (filterMode: "SPL"/"SQL"). A WHERE clause put inqueryis never run: the panel silently shows every row.filterMode: "MFD"panels keep plain equality filters asfilters: {"<field>": ["<value>", ...]}.
Events query
selectedMode: "events" reads custom events: GitHub pushes, pull requests, comments and
reviews, CI runs and jobs, deployments, security alerts, and events customers push. Same
shape as a logs query (so columnFields is required), with these differences:
filterModeisMFDorADVANCED_QUERY. Events have no SPL or SQL.- Fields come from
get-fieldswithsignal: "events":timestamp,severity(infosuccesswarningerrorcritical),type,title,message,repository,actor,status,category,source,service,environment,namespace,cluster,workload,pod,container,event_id. Anything else is an attribute:@vcs.ref.head.name,@cicd.pipeline.name,@vcs.actor.is_bot. - Array paths (
@key[*]) are refused.urlandtimestampcannot be filtered on; use the time range for time.
{
"selectedMode": "events",
"label": "A",
"columnFields": [],
"filterMode": "ADVANCED_QUERY",
"filters": {
"advanced_query": ["category = deployment AND severity IN (error, critical) AND environment = production"]
},
"aggregation": { "function": "row_count" },
"groupBy": [{ "field": "repository", "type": "string", "is_attribute": false }]
}
RUM query
selectedMode: "rum" reads real user monitoring events from browser and mobile apps.
The event type picks the table, so it is a second field, rumEventType:
session | view | action | error | resource | long_task. Same shape as a logs
query (so columnFields is required), with these differences:
rumEventTypeis required. Arumquery without it fails validation and is refused on save. The webapp repairs a missing one toview, silently changing the table.- The stored form differs from the MCP form.
analyze-telemetrytakes the event type inside the mode (selectedMode: "rum_view"). A panel storesselectedMode: "rum"plusrumEventType: "view". To turn a testedanalyze-telemetryquery into a panel, split the mode and keep everything else. filterModeisADVANCED_QUERY. RUM has no SPL or SQL, and the panel editor has no mode toggle for it. The WHERE clause goes infilters.advanced_query.- Fields and rules come from kubesense-rum:
get-fieldswith the matching signal, LIKE only on low-cardinality fields, array fields filter-only, no group-by on a raw duration,feature_flag.<key>group-by on view and error only. - Measure durations on the base field (
lcp,duration), which is stored in nanoseconds. The_ms/_stwins (lcp_ms) are filter-only: use them in the WHERE clause, never as an aggregation field or group-by. LeavefieldConfig.unitunset: the chart detects a base duration and shows it as a readable duration. A fixednanosecondsunit prints the raw count (12500000000.00ns). - Numeric aggregations (
avg,sum,min,max,p50,p75,p90,p95,p99) needfieldswithtype: "float", as on logs. - RUM is not offered on alert rules; see kubesense-alerts.
- Recipes (exact unique users and p75 with a
totalstat, crash-free users, Web Vital good/poor shares, Apdex, top errors and URLs, ANR rate): kubesense-rum/references/dashboard-recipes.md.
{
"selectedMode": "rum",
"rumEventType": "view",
"label": "A",
"columnFields": [],
"filterMode": "ADVANCED_QUERY",
"filters": { "advanced_query": ["browser_name = Chrome AND env = production"] },
"aggregation": {
"function": "p90",
"fields": [ { "field": "lcp", "type": "float", "is_attribute": false } ]
},
"groupBy": [ { "field": "view_name", "type": "string", "is_attribute": false } ]
}
Formula query
{ "selectedMode": "formula", "label": "C", "expression": "A/B", "visible": true, "fieldConfig": {} }
expression must match ^[A-Z0-9+/*()-]+$ after whitespace is stripped. Consequences:
- Uppercase only —
a+bfails. - No decimal point —
A*1.5fails. UseA*3/2. - Labels are single letters A–Z; a two-character label breaks the dependency check.
- The formula must appear after the queries it references in the
queriesarray. - It cannot reference itself, or a label that doesn't exist.
Per-query color
Any query arm (metrics, logs, traces, formula) may carry fieldConfig.color. It colours
every series that query yields and outranks the panel colorScheme, including the
stat panel's default base threshold. Only an explicit colorScheme of type thresholds
outranks it. Use it whenever the meaning of a query is fixed — errors red, success
green — so the colour does not depend on the query's position in the panel.
{ "selectedMode": "traces", "label": "A", "...": "...",
"fieldConfig": { "color": { "type": "single", "color": "#4AAD5A" } } }
{ "selectedMode": "traces", "label": "B", "...": "...",
"fieldConfig": { "color": { "type": "palette", "palette": "error" } } }
single— one hex colour (#rgb,#rrggbb, or with alpha). A grouped query that returns several series is drawn in shades of it, not all identical.palette—default|success|warning|error, cycled from the query's first series. Optionaloffset(integer ≥ 0) starts at a later slot.- Omit
color(or the wholefieldConfig) to inherit the panel scheme.
A non-hex colour or an unknown palette name fails validation on import; the UI, if it ever reads one, drops back to the panel scheme. Full shape in references/panel-config.md.
Filters
filters is Record<string, string[]>:
{ "namespace": ["production"], "level": ["ERROR", "FATAL"] }
- Attribute keys are prefixed
@_@, e.g."@_@user.id": ["abc"]. - Exclusion is a
-prefix on the value:{"namespace": ["-kube-system"]}. - A
$namevalue is a dashboard-variable reference. - A
"$$name": ["$$name"]entry is a field reference: the variable's field, filtered to its selection. See references/variables-and-rows.md. - On a metrics query, a
~prefix makes the value a regex, and-~a negated one:{"namespace": ["~kube-.*"], "pod": ["-~test-.*"]}rendersnamespace=~"kube-.*", pod!~"test-.*".-alone gives!=, so{"container": ["-"]}iscontainer!="".
Metrics Query Functions
functions is an ordered pipeline: each entry applies to the result of the one before.
Builder mode covers any single-query MetricsQL function (rollup, transform, label and
aggregate functions, and scalar operators); a query that combines several series goes in
code mode instead.
"functions": [
{ "type": "range", "name": "rate", "arguments": [ { "arg_name": "over", "arg_value": "5m" } ] },
{ "type": "aggregations", "name": "sum", "arguments": [ { "arg_name": "by", "arg_value": ["namespace"] } ] }
]
namepicks the function and fixes itstypeand its argument names.argumentsholds{arg_name, arg_value}entries in any order. Leave one out to take its default, or, for an optional one, to leave it unrendered. The exception is a label list marked required in the reference (label_keep,labels_equal, thesort_by_labelfamily, …): it must be present with at least that many labels, or the import fails.- A rollup's
overwindow takes any duration ("15m","1h30m") or a macro ("$__rate_interval"); omit it and the query engine picks one. - Modifiers are arguments too:
by/without(label lists) andlimiton aggregateskeep_metric_names: trueon rollups, transforms and operatorsbool: trueon comparisonsstepfor a[window:step]subquery
- Validation rejects an unknown
nameorarg_name, a value of the wrong kind, and a malformed window, naming the function it objects to.
Before writing any function, read
references/metrics-functions.md. It lists every
function with its type, each argument's name, kind and default, and a verified example of
the PromQL it renders. Argument names differ between look-alike functions: quantile takes
phi, while quantile_over_time and histogram_quantile take quantile.
Grid Layout
{ "i": "0", "x": 0, "y": 0, "w": 6, "h": 4 }
All five keys required. 12-column grid, rowHeight 100px, panel minH 2. No bounds are
validated — w: 99 is accepted and renders broken.
x: 0–11. Side by side:0, 6for two columns;0, 4, 8for three.y: increment by the previous row's height.i: the array index as a string. Matching is positional, so keepgridLayoutin the same order aspanels, and at least as long.
The pairing is per page. A page is {panels, gridLayout, subGrids, subGridLayout}. An
untabbed dashboard's top level is one page, and each tab carries its own page. Inside each
page, gridLayout[n] positions panels[n], and y starts at 0 again.
Variables and Rows
Both are optional and most dashboards need neither — omit variables, subGrids, and
subGridLayout and they default to [].
If the dashboard needs a template variable (a dropdown feeding $name into query
filters) or rows (collapsible panel groups), read
references/variables-and-rows.md for the schemas.
Two things to carry into that file: a variable's description is required (use ""), and
one invalid variable silently deletes every variable.
Tabs
Tabs split a dashboard into pages the viewer switches between. They are optional, and a dashboard is either one page or a list of tabs, never both:
{
"gridLayout": [], "panels": [], "subGrids": [], "subGridLayout": [],
"variables": [], "eventOverlays": [],
"tabs": [
{ "id": "overview", "title": "Overview", "panels": [], "gridLayout": [], "subGrids": [], "subGridLayout": [] }
]
}
- Each tab is
{id, title}plus its own page. Its panels, layout and rows live inside it. - On a tabbed dashboard the top-level
panels,gridLayout,subGridsandsubGridLayoutstay present and empty. variables,eventOverlaysandpublicDashboardPathstay at the top level and apply to every tab. There is no per-tab variable or overlay.- An untabbed dashboard omits
tabsor sends[].
For a complete tabbed example, the id and title rules, and when to use tabs instead of rows, read references/tabs.md.
Event Overlays
If the dashboard should mark events on its charts (deployments, releases, CI runs),
read references/event-overlays.md for the schema and
a worked example. It covers the top-level eventOverlays array and each panel's
config.eventOverlay (inherit | custom | off). Two things to carry into that file:
color is a palette name (hex is refused), and only timeSeries and bar panels draw
markers. On any other panel type an overlay validates and does nothing.
Delivering It
Creating it directly
validate-dashboard-json → valid=true → create-dashboard
create-dashboard takes name, preset (the object, or a JSON string containing it) and
an optional description. It returns the dashboard id and its UI path — quote that path so
the user can open it.
It is a write tool: only call it when the user has clearly asked for a dashboard to be created, and say what you are about to create before calling. If it refuses, the response names the JSON Pointer for every problem; fix them and retry rather than falling back to handing over JSON.
Editing an existing dashboard
list-dashboards → get-dashboard-details → update-dashboard (panel_operations + preset_version)
update-dashboard takes dashboard_id plus any of name, description,
panel_operations or preset. Like create-dashboard it is a write tool: say what
you are about to change, and call it only when the user asked for the change. It needs
edit access on the dashboard.
System dashboards are read-only. list-dashboards reports type: system for a
dashboard KubeSense ships (one per integration service, such as "AWS RDS Overview" or
"Kubernetes Pods Overview"), user for one a person made. update-dashboard refuses a
system dashboard for everyone. To change one, the user clones it in the UI (Clone on the
dashboard or on the integration's Dashboards tab) and you edit the copy, which is a user
dashboard with the same name; filter with type: "user" to find it. A system dashboard
with an integration_id is listed only while that integration has a connected account.
Edit panels with panel_operations, not a whole preset. get-dashboard-details
returns a projection — queries only, no layout, colours, axes or thresholds — so a preset
rebuilt from it silently deletes all of those. panel_operations edits the stored
document in place and keeps everything you never saw.
get-dashboard-details gives what the operations need:
position— the panel's index within its section, from 0. Panels have no id.sub_grid_id— the row (sub-grid) the panel is in; empty for a top-level panel.tab_idandtab_title— the tab the panel is on; empty on an untabbed dashboard. The response also lists the dashboard's tabs.preset_version— pass it back unchanged aspreset_version. Required withpanel_operations.rendered_promql— on a builder-mode metrics query, the PromQL the panel runs (the storedpromqlis empty in builder mode), with$$namefilters expanded to<field>="$name". Read-only: it is not part of the stored query, so never send it back in a panel patch.
Each operation is one of:
{"op": "update_panel", "position": 2, "panel": {"name": "p99 latency"}}
{"op": "add_panel", "panel": { /* the whole new panel */ }, "grid_layout": {"w": 6, "h": 4}}
{"op": "remove_panel", "position": 0}
A panel's address is tab_id, sub_grid_id and position. Add "sub_grid_id": "<id>"
to act inside a row; omit it for the page's top-level panels. On a tabbed dashboard every
operation, add_panel included, needs "tab_id": "<id>". A missing or unknown tab_id
refuses the call, and the error lists the valid tab ids. On an untabbed dashboard, omit
tab_id.
{"op": "update_panel", "tab_id": "node-health", "sub_grid_id": "row-disk", "position": 1, "panel": {"name": "Disk IO"}}
update_panelis a JSON merge patch (RFC 7386): objects merge key by key,nulldeletes a key, and arrays are replaced whole — to change one query, send the fullqueriesarray. An optionalgrid_layout{x, y, w, h}moves or resizes the panel; only the keys you give change. It needs apanelpatch, agrid_layout, or both.add_panelappends a whole panel, which must pass the same checks ascreate-dashboard. It takes noposition. Withoutgrid_layoutit goes in a new row below everything else, sized like the section's first cell.remove_paneltakes onlyposition(andtab_id,sub_grid_id); it removes the panel and its layout cell.
Positions refer to the dashboard as you read it, even after an earlier operation in
the same call removed a panel — do not re-count. Target each position at most once per
call; combine two edits to one panel into one update_panel. All operations are applied
in one write, and one bad operation refuses the whole call, naming
panel_operations[i].
Refusals to expect:
| Message says | Do |
|---|---|
the dashboard changed since it was read / was saved by someone else | Call get-dashboard-details again and rebuild the edit from the new positions and preset_version. Never reuse the old ones. |
position N does not exist | Re-read; the position is out of range for that section. |
sub-grids share id / panel(s) but … gridLayout entr(ies) | That section cannot be edited by position — fall back to a whole preset. |
preset and panel_operations cannot be combined | Send one or the other. |
a missing or unknown tab_id, with the valid ids | Retry with one of the listed ids. |
this dashboard has tabs and the preset has no tabs key (409) | Your whole preset had no tabs key. Re-read with raw=true and send the preset back with its tabs array. |
On success it returns the id, name and a new preset_version; a further edit in the
same conversation can use that without reading again.
Whole-preset rewrite — only when the edit cannot be expressed as panel operations
(reordering, restructuring rows, variables, and adding, removing, renaming or reordering
tabs). Read with get-dashboard-details raw=true, which adds the full stored preset;
change what you need; run it through validate-dashboard-json; send the whole object back
as preset. Anything you leave out is deleted. Pass preset_version here too, so a
concurrent save is refused instead of overwritten.
On a tabbed dashboard the preset you send must keep the tabs key. A preset with no
tabs key over a tabbed dashboard looks like an old client that would drop the tabs, so
the server refuses it with 409. Moving a panel to another tab is also a rewrite: take it
out of one tab's panels and gridLayout and append it to the other's.
A name- or description-only update needs neither.
Handing over JSON to import
- Copy the JSON to a
.jsonfile (the import UI requiresapplication/json). - KubeSense → Dashboards → Import.
- Upload and review, then save.
On this path never claim the dashboard was created — the user imports and confirms it.
Rules
Rule 0: run validate-dashboard-json before creating or handing over, and fix what it
reports. Everything in What Hard-Fails Import is machine-checked
— the validator names the JSON Pointer, so it needs no checklist here.
This checklist is for what the validator is blind to. Every rule below passes validation and then silently discards your data or crashes at render. A green validation is not a working dashboard — check these by hand before you hand it over.
gridLayoutmust be at least as long aspanels, in the same order — matching is positional, and a short layout throws a TypeError when the dashboard renders.- Numeric aggregations need
fields[].type: "float"exactly, or the whole aggregation resets torow_count— a row count where you asked for a percentile. chart_typeis lowercasetimeseries;panelTypeis camelCasetimeSeries. Each resets to its own default (table/timeSeries) on a mismatch.- Variables need
description(use"") and a regex-validname≤ 20 chars — one bad variable deletes them all. - Use real y-axis units (
percentage,mCPU,bytes/sec) —percent,short,nonebecomeauto. - Don't emit
enableThresholds,colorPalette,mergeTables: false,topListLabel, ortopListValue— none exist, and unknown keys are stripped without comment. On a top list, value colouring goes invisualFormattingRules, notthresholds. - Prefer omitting an optional field to guessing it: an omitted field takes its default, a wrong one can reset its siblings.
- Validation checks shape, not existence. Discover metric and field names with MCP before writing queries, and tell the user to confirm on the panel preview.
- On a tabbed dashboard, put each panel's layout cell in the same tab as the panel, at the
same index. Every whole-preset rewrite keeps the
tabskey, and everypanel_operationsentry carriestab_id. - Keep
variablesandeventOverlaysat the top level of the preset, never inside a tab. They apply to every tab.
The one rule that spans both: preset is a stringified JSON string in the import envelope,
but the plain object when passed to create-dashboard or validate-dashboard-json.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/kubesense-ai/kubesense-mcp-skills/kubesense-dashboards">View kubesense-dashboards on skillZs</a>