Grafana dashboard: Detailed Node Memory
Description: Gives Detailed Node Memory Metrics of Kubernetes Cluster
1) Used Memory
2) SWAP
3) Cache
4) Buffer
5) Available Memory in %


{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.2.1"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 10548,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1563270354846,
  "links": [],
  "panels": [
    {
      "alert": {
        "conditions": [
          {
            "evaluator": {
              "params": [
                1
              ],
              "type": "gt"
            },
            "operator": {
              "type": "and"
            },
            "query": {
              "params": [
                "B",
                "10s",
                "now"
              ]
            },
            "reducer": {
              "params": [],
              "type": "percent_diff"
            },
            "type": "query"
          }
        ],
        "executionErrorState": "keep_state",
        "frequency": "10s",
        "handler": 1,
        "name": "Memory - nodename alert",
        "noDataState": "alerting",
        "notifications": []
      },
      "aliasColors": {
        "Swap Used": "#890f02",
        "Swap User": "#bf1b00"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 1,
      "description": "Memory Stats of $nodename",
      "editable": true,
      "error": false,
      "fill": 1,
      "grid": {},
      "gridPos": {
        "h": 16,
        "w": 18,
        "x": 0,
        "y": 0
      },
      "id": 14,
      "isNew": true,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": true,
        "rightSide": false,
        "show": true,
        "sideWidth": null,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "minSpan": null,
      "nullPointMode": "connected",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "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
        },
        {
          "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"
        },
        {
          "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"
        },
        {
          "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"
        },
        {
          "expr": "sum (node_memory_MemTotal_bytes{instance=~\"$instance_ip\",job=\"node-exporter\"})",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "Total Physical RAM",
          "refId": "E"
        }
      ],
      "thresholds": [
        {
          "colorMode": "critical",
          "fill": true,
          "line": true,
          "op": "gt",
          "value": 1
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Memory - $nodename",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "bytes",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": 0,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "rgba(50, 172, 45, 0.97)",
        "rgba(237, 129, 40, 0.89)",
        "rgba(245, 54, 54, 0.9)"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 3,
      "description": "Total Physical Memory: $nodename",
      "editable": true,
      "error": false,
      "format": "bytes",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 0
      },
      "height": "1px",
      "id": 8,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "70%",
      "prefix": "",
      "prefixFontSize": "70%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "repeat": null,
      "repeatDirection": "h",
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "Value",
      "targets": [
        {
          "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
        }
      ],
      "thresholds": "",
      "title": "Total Physical Memory: $nodename",
      "type": "singlestat",
      "valueFontSize": "70%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": true,
      "colors": [
        "#bf1b00",
        "#508642",
        "#e5ac0e"
      ],
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 3,
      "description": "Available Memory in % : $nodename \nCalcualtion Used : Total - Free - Cache - Buffer",
      "editable": true,
      "error": false,
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 5
      },
      "height": "1px",
      "id": 16,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "minSpan": 4,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "70%",
      "prefix": "",
      "prefixFontSize": "70%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "repeat": null,
      "repeatDirection": "v",
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "Value",
      "targets": [
        {
          "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
        }
      ],
      "thresholds": "5,90",
      "title": "Available Memory in % : $nodename",
      "transparent": false,
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "current"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 16,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "nodename",
        "options": [],
        "query": "label_values(node_uname_info,nodename)",
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 2,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "instance_ip",
        "options": [],
        "query": "label_values(node_uname_info{nodename='$nodename'},instance)",
        "refresh": 1,
        "regex": "",
        "sort": 3,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-30d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "60d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Detailed Node Memory",
  "uid": "uQwSmjIWk",
  "version": 4,
  "description": "Gives Detailed Node Memory Metrics of Kubernetes Cluster\n1) Used Memory\n2) SWAP\n3) Cache\n4) Buffer\n5) Available Memory in %"
}