Skip to content

Instantly share code, notes, and snippets.

@AtaxyaNetwork
Created September 1, 2026 12:36
Show Gist options
  • Select an option

  • Save AtaxyaNetwork/b3c05bb4518c52279da87f3c8ecfc952 to your computer and use it in GitHub Desktop.

Select an option

Save AtaxyaNetwork/b3c05bb4518c52279da87f3c8ecfc952 to your computer and use it in GitHub Desktop.
Grafana Dashboard - Vates VMS - Resource Waste Monitor
{
"apiVersion": "dashboard.grafana.app/v2",
"kind": "Dashboard",
"metadata": {
"name": "infrastructure-waste",
"namespace": "default",
"uid": "62ef150f-49da-4b3f-a3a0-4c55bdcb191e",
"resourceVersion": "1788266029884986",
"generation": 35,
"creationTimestamp": "2026-07-20T15:04:54Z",
"labels": {
"grafana.app/deprecatedInternalID": "3061587733803008"
},
"annotations": {
"grafana.app/createdBy": "user:afju07j8xxm9sa",
"grafana.app/saved-from-ui": "Grafana v13.2.0 (f681b1359f)",
"grafana.app/updatedBy": "user:afju07j8xxm9sa",
"grafana.app/updatedTimestamp": "2026-09-01T12:33:49Z"
}
},
"spec": {
"annotations": [
{
"kind": "AnnotationQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "grafana",
"version": "v0",
"spec": {}
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"builtIn": true
}
}
],
"cursorSync": "Off",
"editable": true,
"elements": {
"panel-11": {
"kind": "Panel",
"spec": {
"id": 11,
"title": "RAM Usage",
"description": "Blue: > 30%\nGreen: >=30% and =< 70%\nRed: > 70%",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "100 * (1 - (avg_over_time(xcp_vm_memory_internal_free_bytes[$__range]) / avg_over_time(xcp_vm_memory_target_bytes[$__range])))",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false
}
},
"refId": "A",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "100 * (1 - (max_over_time(xcp_vm_memory_internal_free_bytes[$__range]) / max_over_time(xcp_vm_memory_target_bytes[$__range])))",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false
}
},
"refId": "B",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "100 * (1 - (min_over_time(xcp_vm_memory_internal_free_bytes[$__range]) / min_over_time(xcp_vm_memory_target_bytes[$__range])))",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false
}
},
"refId": "C",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "last_over_time(xcp_vm_memory_target_bytes[$__range]) / 1024 / 1024 / 1024",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "__auto",
"range": false
}
},
"refId": "D",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "avg_over_time(xcp_vm_cpu_usage[$__range]) * 100",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false
}
},
"refId": "E",
"hidden": false
}
},
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "xcp_vm_status",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false
}
},
"refId": "G",
"hidden": false
}
}
],
"transformations": [
{
"kind": "Transformation",
"group": "merge",
"spec": {
"options": {}
}
},
{
"kind": "Transformation",
"group": "filterByValue",
"spec": {
"options": {
"filters": [
{
"config": {
"id": "equal",
"options": {
"value": "Running"
}
},
"fieldName": "power_state"
},
{
"config": {
"id": "equal",
"options": {
"value": "false"
}
},
"fieldName": "is_control_domain"
}
],
"match": "all",
"type": "include"
}
}
},
{
"kind": "Transformation",
"group": "groupBy",
"spec": {
"options": {
"fields": {
"Value #A": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #B": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #C": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #D": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #E": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"Value #F": {
"aggregations": [
"last"
]
},
"host_name": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"pool_name": {
"aggregations": [
"last"
],
"operation": "aggregate"
},
"uuid": {
"aggregations": [
"count"
],
"operation": "groupby"
},
"vm_name": {
"aggregations": [
"last"
],
"operation": "aggregate"
}
}
}
}
},
{
"kind": "Transformation",
"group": "filterFieldsByName",
"spec": {
"options": {
"byVariable": false,
"include": {
"names": [
"host_name (last)",
"pool_name (last)",
"Value #A (last)",
"Value #B (last)",
"Value #C (last)",
"Value #D (last)",
"Value #E (last)",
"Value #F (last)",
"vm_name (last)"
]
}
}
}
},
{
"kind": "Transformation",
"group": "organize",
"spec": {
"options": {
"excludeByName": {},
"includeByName": {},
"indexByName": {
"Value #A (last)": 4,
"Value #B (last)": 5,
"Value #C (last)": 6,
"Value #D (last)": 7,
"Value #E (last)": 3,
"Value #F (last)": 8,
"host_name (last)": 1,
"pool_name (last)": 0,
"vm_name (last)": 2
},
"renameByName": {
"Value #A": "%RAM Average",
"Value #A (last)": "%RAM Average",
"Value #B": "%RAM Min",
"Value #B (last)": "%RAM Min",
"Value #C": "%RAM Max",
"Value #C (last)": "%RAM Max",
"Value #D": "Allocated RAM (in GB)",
"Value #D (last)": "RAM Allocated",
"Value #E": "%CPU Average",
"Value #E (last)": "%CPU Average",
"Value #F": "Power (W)",
"Value #F (last)": "Power (W)",
"host_name": "Host",
"host_name (last)": "Host",
"pool_name": "Pool",
"pool_name (last)": "Pool",
"uuid": "",
"vm_name": "VM",
"vm_name (last)": "VM"
}
}
}
}
],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "table",
"version": "13.2.0",
"spec": {
"options": {
"cellHeight": "sm",
"enablePagination": true,
"showHeader": true,
"sortBy": []
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": 0,
"color": "dark-blue"
},
{
"value": 30,
"color": "dark-green"
},
{
"value": 70,
"color": "dark-red"
}
]
},
"color": {
"mode": "thresholds"
},
"custom": {
"align": "center",
"cellOptions": {
"type": "auto"
},
"filterable": true,
"footer": {
"reducers": []
},
"inspect": false,
"wrapHeaderText": false,
"wrapText": false
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"scope": "series",
"options": "%CPU Average"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
}
]
},
{
"matcher": {
"id": "byName",
"scope": "series",
"options": "%RAM Average"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
}
]
}
]
}
}
}
}
},
"panel-12": {
"kind": "Panel",
"spec": {
"id": 12,
"title": "VM with Under-Utilized RAM",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"expr": "count(\r\n max by (uuid) (\r\n 100 * (\r\n 1 -\r\n (\r\n avg_over_time(xcp_vm_memory_internal_free_bytes{is_control_domain=\"false\"}[$__range])\r\n /\r\n avg_over_time(xcp_vm_memory_target_bytes{is_control_domain=\"false\"}[$__range])\r\n )\r\n ) < 20\r\n )\r\n)",
"format": "time_series",
"interval": "",
"legendFormat": "Under-Utilized VMs",
"range": true
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "13.2.0",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {},
"textMode": "auto",
"wideLayout": true
},
"fieldConfig": {
"defaults": {
"unit": "short",
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": 0,
"color": "orange"
}
]
},
"color": {
"mode": "thresholds"
},
"noValue": "--"
},
"overrides": []
}
}
}
}
},
"panel-3": {
"kind": "Panel",
"spec": {
"id": 3,
"title": "Wasted RAM",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"exemplar": false,
"expr": "sum(xcp_vm_memory_internal_free_bytes{is_control_domain=\"false\"})",
"format": "time_series",
"instant": true,
"interval": "",
"legendFormat": "Wasted RAM",
"range": false
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "13.2.0",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {},
"textMode": "auto",
"wideLayout": true
},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": 0,
"color": "green"
}
]
},
"color": {
"mode": "thresholds"
},
"noValue": "--"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Wasted RAM"
},
"properties": [
{
"id": "unit",
"value": "decbytes"
}
]
}
]
}
}
}
}
},
"panel-4": {
"kind": "Panel",
"spec": {
"id": 4,
"title": "Total Allocated Memory",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"expr": "sum(xcp_vm_memory_target_bytes{is_control_domain=\"false\"})",
"format": "time_series",
"interval": "",
"legendFormat": "Total Allocated",
"range": true
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "13.2.0",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {},
"textMode": "auto",
"wideLayout": true
},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": 0,
"color": "blue"
}
]
},
"color": {
"mode": "thresholds"
},
"noValue": "--"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Total Allocated"
},
"properties": [
{
"id": "unit",
"value": "decbytes"
}
]
}
]
}
}
}
}
},
"panel-8": {
"kind": "Panel",
"spec": {
"id": 8,
"title": "VM with Under-Utilized CPU",
"description": "",
"links": [],
"data": {
"kind": "QueryGroup",
"spec": {
"queries": [
{
"kind": "PanelQuery",
"spec": {
"query": {
"kind": "DataQuery",
"group": "prometheus",
"version": "v0",
"datasource": {
"name": "dfjr5f4k3yxa8a"
},
"spec": {
"editorMode": "code",
"expr": "count(\r\n max by (uuid) (\r\n xcp_vm_cpu_usage{is_control_domain=\"false\"}\r\n ) < 0.2\r\n )",
"format": "time_series",
"interval": "",
"legendFormat": "Under-Utilized VMs",
"range": true
}
},
"refId": "A",
"hidden": false
}
}
],
"transformations": [],
"queryOptions": {}
}
},
"vizConfig": {
"kind": "VizConfig",
"group": "stat",
"version": "13.2.0",
"spec": {
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {},
"textMode": "auto",
"wideLayout": true
},
"fieldConfig": {
"defaults": {
"unit": "short",
"thresholds": {
"mode": "absolute",
"steps": [
{
"value": 0,
"color": "orange"
}
]
},
"color": {
"mode": "thresholds"
},
"noValue": "--"
},
"overrides": []
}
}
}
}
}
},
"layout": {
"kind": "GridLayout",
"spec": {
"items": [
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 0,
"width": 6,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-4"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 6,
"y": 0,
"width": 6,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-3"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 12,
"y": 0,
"width": 6,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-12"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 18,
"y": 0,
"width": 6,
"height": 8,
"element": {
"kind": "ElementReference",
"name": "panel-8"
}
}
},
{
"kind": "GridLayoutItem",
"spec": {
"x": 0,
"y": 8,
"width": 24,
"height": 26,
"element": {
"kind": "ElementReference",
"name": "panel-11"
}
}
}
]
}
},
"links": [],
"liveNow": false,
"preload": false,
"tags": [
"infrastructure",
"resources",
"waste",
"xcp"
],
"timeSettings": {
"timezone": "browser",
"from": "now-90d",
"to": "now",
"autoRefresh": "",
"autoRefreshIntervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"hideTimepicker": false,
"fiscalYearStartMonth": 0
},
"title": "Vates VMS - Resource Waste Monitor",
"variables": []
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment