Skip to content

Instantly share code, notes, and snippets.

@nuved
Created August 26, 2025 12:03
Show Gist options
  • Save nuved/1783c6a1b788ad0f0091a1cd5bf50f15 to your computer and use it in GitHub Desktop.
Save nuved/1783c6a1b788ad0f0091a1cd5bf50f15 to your computer and use it in GitHub Desktop.
Detailed Node Memory + swap
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Gives Detailed Node Memory Metrics of Kubernetes Cluster\n1) Used Memory\n2) SWAP\n3) Cache\n4) Buffer\n5) Available Memory in %",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 32,
"links": [],
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"description": "Memory Stats of $nodename",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": true,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"decimals": 2,
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "transparent"
},
{
"color": "red",
"value": 1
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Swap Used"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#890f02",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Swap User"
},
"properties": [
{
"id": "color",
"value": {
"fixedColor": "#bf1b00",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 16,
"w": 18,
"x": 0,
"y": 0
},
"id": 14,
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull",
"max",
"min"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "multi",
"sort": "none"
}
},
"pluginVersion": "12.0.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "node_memory_MemTotal_bytes{job='node-exporter',instance=~\"$instance_ip\"} - node_memory_MemFree_bytes{job='node-exporter',instance=~\"$instance_ip\"} - node_memory_Buffers_bytes{job='node-exporter',instance=~\"$instance_ip\"} - node_memory_Cached_bytes{job='node-exporter',instance=~\"$instance_ip\"}\n",
"format": "time_series",
"hide": false,
"instant": false,
"interval": "",
"intervalFactor": 1,
"legendFormat": "Used Memory",
"refId": "A",
"step": 60
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "node_memory_MemFree_bytes{job='node-exporter',instance=~\"$instance_ip\"}",
"format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 1,
"legendFormat": "Free Memory",
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "(node_memory_SwapTotal_bytes{instance=~\"$instance_ip\",job='node-exporter'} - node_memory_SwapFree_bytes{instance=~\"$instance_ip\",job='node-exporter'})",
"format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 1,
"legendFormat": "Swap Used",
"refId": "C"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "node_memory_Cached_bytes{instance=~\"$instance_ip\",job='node-exporter'} + node_memory_Buffers_bytes{instance=~\"$instance_ip\",job='node-exporter'}",
"format": "time_series",
"hide": false,
"instant": false,
"intervalFactor": 1,
"legendFormat": "Cache + Buffer",
"refId": "D"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum (node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "Total Physical RAM",
"refId": "E"
}
],
"title": "Memory - $nodename",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"description": "Total Physical Memory: $nodename",
"fieldConfig": {
"defaults": {
"decimals": 3,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green"
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 18,
"y": 0
},
"id": 8,
"maxDataPoints": 100,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^Value$/",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.0.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum (node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"})",
"format": "time_series",
"hide": false,
"instant": false,
"interval": "10s",
"intervalFactor": 1,
"refId": "A",
"step": 10
}
],
"title": "Total Physical Memory: $nodename",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"description": "Available Memory in % : $nodename \nCalcualtion Used : Total - Free - Cache - Buffer",
"fieldConfig": {
"defaults": {
"decimals": 3,
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "#bf1b00"
},
{
"color": "#508642",
"value": 5
},
{
"color": "#e5ac0e",
"value": 90
}
]
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 6,
"x": 18,
"y": 5
},
"id": 16,
"maxDataPoints": 100,
"maxPerRow": 6,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^Value$/",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.0.2",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "(node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"} - (node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"} - node_memory_MemFree_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"} - node_memory_Buffers_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"} - node_memory_Cached_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"})) / node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"} * 100\n ",
"format": "time_series",
"hide": false,
"instant": true,
"interval": "10s",
"intervalFactor": 1,
"refId": "A",
"step": 10
}
],
"title": "Available Memory in % : $nodename",
"type": "stat"
}
],
"preload": false,
"refresh": "5s",
"schemaVersion": 41,
"tags": [],
"templating": {
"list": [
{
"current": {
"text": "ip-10-60-43-94",
"value": "ip-10-60-43-94"
},
"datasource": "prometheus",
"includeAll": false,
"name": "nodename",
"options": [],
"query": "label_values(node_uname_info,nodename)",
"refresh": 1,
"regex": "",
"sort": 1,
"type": "query"
},
{
"current": {
"text": "10.60.43.94:9100",
"value": "10.60.43.94:9100"
},
"datasource": "prometheus",
"hide": 2,
"includeAll": false,
"name": "instance_ip",
"options": [],
"query": "label_values(node_uname_info{nodename='$nodename'},instance)",
"refresh": 1,
"regex": "",
"sort": 3,
"type": "query"
}
]
},
"time": {
"from": "now-30d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Detailed Node Memory",
"uid": "bc5be25c-e0b9-4e12-b1ce-d5c6a4b33ed6",
"version": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment