Why the Grafana Table Panel Is the Ultimate Tool for Precise Monitoring
This article explains how the Grafana Table panel serves as a versatile, data‑driven Swiss‑army‑knife for deep troubleshooting, covering its advantages, typical use cases, step‑by‑step configuration, PromQL queries, JSON panel definition, and visual customization tips.
In previous articles we covered Stat for status, Time Series for trends, Gauge for water level, and Pie Chart for composition. While each visual has its strengths, complex problems that require precise investigation, multi‑dimensional comparison, and detailed digging demand a more powerful tool.
Enter the Table panel – seemingly simple but, in the eyes of seasoned operators, the "Swiss army knife" of monitoring that can deliver decisive answers during late‑night incident investigations.
Why the Table panel is the "ultimate weapon"?
Common database queries such as logs, traces, metrics
Financial reports
Customer lists
Product catalogs
Tip: Any information that could be placed in a spreadsheet is often best visualized in a table.
Creating a Table visualization in the browser
Create the visualization.
Select the Table visualization.
In Panel options, set the panel Title.
In Panel options, set the panel Description.
PromQL settings
Metrics browser: PromQL statements.
Option.Legend: format displayed fields.
Transform data settings
Merge multiple PromQL results: Add transformation > Join by field, mode OUTER (TIME SERIES), field pod_container.
Select displayed fields: Add another transformation > Organize fields by name.
Table settings
Column alignment: configure how Grafana aligns cell content.
Column filter: field filtering.
Table footer settings
Show table footer: enable footer display.
Add field override settings
Match fields by regex (e.g., /.*Memory/) and set unit to bytes.
Match field by name pod_container, set width to 300 and alignment to left.
JSON panel definition
{
"datasource": {"uid": "${datasource}"},
"description": "值为空的话,则可以使用pod所在节点该类型的资源",
"fieldConfig": {
"defaults": {"custom": {"align": "center", "filterable": true}},
"overrides": [
{"matcher": {"id": "byRegexp", "options": "/.*Memory/"}, "properties": [{"id": "unit", "value": "bytes"}]},
{"matcher": {"id": "byName", "options": "pod_container"}, "properties": [{"id": "custom.width", "value": 300}, {"id": "custom.align", "value": "left"}]}
]
},
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 0},
"options": {"footer": {"reducer": ["sum"], "show": true}, "showHeader": true},
"targets": [
{"editorMode": "code", "expr": "label_join(
kube_pod_container_resource_requests{resource=\"cpu\", namespace=~\"$namespace.*\"},
\"pod_container\",
\" | \",
\"pod\",
\"container\")", "format": "table", "instant": true, "refId": "A"},
{"editorMode": "code", "expr": "label_join(
kube_pod_container_resource_requests{resource=\"memory\", namespace=~\"$namespace.*\"},
\"pod_container\",
\" | \",
\"pod\",
\"container\")", "format": "table", "instant": true, "refId": "B"},
{"editorMode": "code", "expr": "label_join(
kube_pod_container_resource_limits{resource=\"cpu\", namespace=~\"$namespace.*\"},
\"pod_container\",
\" | \",
\"pod\",
\"container\")", "format": "table", "instant": true, "refId": "C"},
{"editorMode": "code", "expr": "label_join(
kube_pod_container_resource_limits{resource=\"memory\", namespace=~\"$namespace.*\"},
\"pod_container\",
\" | \",
\"pod\",
\"container\")", "format": "table", "instant": true, "refId": "D"}
],
"title": "Pod资源限额By命名空间",
"transformations": [
{"id": "joinByField", "options": {"byField": "pod_container", "mode": "outer"}},
{"id": "organize", "options": {"includeByName": {"pod_container": true, "Value #A": true, "Value #B": true, "Value #C": true, "Value #D": true}, "renameByName": {"Value #A": "Requests CPU", "Value #B": "Requests Memory", "Value #C": "Limits CPU", "Value #D": "Limits Memory"}}}
],
"type": "table"
}Conclusion
The Table panel’s role is the "truth guardian" – it doesn’t tell stories, it shows facts. When all other visualizations are theatrical, only the Table can present exact numbers, exact entities, and exact problems.
Linux Ops Smart Journey
The operations journey never stops—pursuing excellence endlessly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
