Grafana dashboard: Cache health

A panel to extract graphs from Prometheus data collected from mtail parsing of custom Nginx logs with hit ratio.

More details coming soon.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.4.4"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.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": 11203,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1573920356096,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 2,
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 13,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(nginx_http_request_total{alias=~\"$alias.*\"}[5m])",
          "format": "time_series",
          "intervalFactor": 2,
          "legendFormat": "Accesses",
          "refId": "A",
          "step": 240
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Request rate on $alias",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null as zero",
      "options": {
        "dataLinks": []
      },
      "percentage": true,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "expr": "nginx_http_request_cache_total{alias=~\"$alias\"}",
          "legendFormat": "{{upstream_cache_status}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Hit ratio on $alias",
      "tooltip": {
        "shared": false,
        "sort": 1,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "percent",
          "label": null,
          "logBase": 1,
          "max": "100",
          "min": null,
          "show": true
        },
        {
          "format": "percent",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 15
      },
      "id": 15,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "histogram_quantile(0.5, sum(rate(nginx_http_request_time_bucket{alias=~\"^$alias.*\"}[5m])) by (vhost,le))",
          "format": "time_series",
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{vhost}}/50pct",
          "refId": "A"
        },
        {
          "expr": "histogram_quantile(0.9, sum(rate(nginx_http_request_time_bucket{alias=~\"^$alias.*\"}[5m])) by (vhost,le))",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{vhost}}/90pct",
          "refId": "B"
        },
        {
          "expr": "histogram_quantile(0.99, sum(rate(nginx_http_request_time_bucket{alias=~\"^$alias.*\"}[5m])) by (vhost,le))",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{vhost}}/99pct",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Request latency on $alias",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "ms",
          "label": null,
          "logBase": 10,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "ms",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 3,
      "editable": true,
      "error": false,
      "fill": 1,
      "fillGradient": 0,
      "grid": {},
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 23
      },
      "id": 5,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "maxPerRow": 6,
      "nullPointMode": "connected",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "100.0 - 100 * (node_filesystem_avail_bytes{alias=~\"$alias.*\",device!~'by-uuid'} / node_filesystem_size_bytes{alias=~\"$alias.*\",device!~'by-uuid'}) or 100.0 - 100 * (node_filesystem_avail{alias=~\"$alias.*\",device!~'by-uuid'} / node_filesystem_size{alias=~\"$alias.*\",device!~'by-uuid'})",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "{{mountpoint}}",
          "metric": "",
          "refId": "A",
          "step": 1200,
          "target": ""
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Disk Space Used on $alias",
      "tooltip": {
        "msResolution": true,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "percent",
          "logBase": 1,
          "max": 100,
          "min": 0,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "editable": true,
      "error": false,
      "fill": 1,
      "fillGradient": 0,
      "grid": {},
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 30
      },
      "id": 9,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "maxPerRow": 6,
      "nullPointMode": "connected",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [
        {
          "alias": "/.*_in/",
          "transform": "negative-Y"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "irate(node_network_receive_bytes_total{alias=~'$alias.*'}[5m])*8 or irate(node_network_receive_bytes{alias=~'$alias.*'}[5m])*8",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "{{device}}_in",
          "metric": "",
          "refId": "A",
          "step": 1200,
          "target": ""
        },
        {
          "expr": "irate(node_network_transmit_bytes_total{alias=~'$alias.*'}[5m])*8 or irate(node_network_transmit_bytes{alias=~'$alias.*'}[5m])*8",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "{{device}}_out",
          "refId": "B",
          "step": 1200
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Network Traffic on $alias",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bits",
          "label": "bits in (-) / bits out (+)",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "editable": true,
      "error": false,
      "fill": 1,
      "fillGradient": 0,
      "grid": {},
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 37
      },
      "id": 7,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "maxPerRow": 6,
      "nullPointMode": "connected",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "node_load1{alias=~\"$alias.*\"}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "load",
          "metric": "",
          "refId": "A",
          "step": 1200,
          "target": ""
        },
        {
          "expr": "node_load5{alias=~\"$alias.*\"}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "load",
          "metric": "",
          "refId": "B",
          "step": 1200,
          "target": ""
        },
        {
          "expr": "node_load15{alias=~\"$alias.*\"}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "load",
          "metric": "",
          "refId": "C",
          "step": 1200,
          "target": ""
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Load on $alias",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "cumulative"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "Slab": "#E5A8E2",
        "Swap": "#E24D42"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_PROMETHEUS}",
      "decimals": 2,
      "editable": true,
      "error": false,
      "fill": 1,
      "fillGradient": 0,
      "grid": {},
      "gridPos": {
        "h": 7,
        "w": 12,
        "x": 0,
        "y": 44
      },
      "id": 11,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "maxPerRow": 6,
      "nullPointMode": "connected",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": "alias",
      "repeatDirection": "h",
      "seriesOverrides": [
        {
          "alias": "/Apps|Buffers|Cached|Free|Slab|SwapCached|PageTables|VmallocUsed/",
          "fill": 5,
          "stack": true
        },
        {
          "alias": "Swap",
          "fill": 5,
          "stack": true
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "( node_memory_MemTotal_bytes{alias=~'$alias.*'} - node_memory_MemFree_bytes{alias=~'$alias.*'} - node_memory_Buffers_bytes{alias=~'$alias.*'} - node_memory_Cached_bytes{alias=~'$alias.*'} - node_memory_SwapCached_bytes{alias=~'$alias.*'} - node_memory_Slab_bytes{alias=~'$alias.*'} - node_memory_PageTables_bytes{alias=~'$alias.*'} - node_memory_VmallocUsed_bytes{alias=~'$alias.*'} ) or ( node_memory_MemTotal{alias=~'$alias.*'} - node_memory_MemFree{alias=~'$alias.*'} - node_memory_Buffers{alias=~'$alias.*'} - node_memory_Cached{alias=~'$alias.*'} - node_memory_SwapCached{alias=~'$alias.*'} - node_memory_Slab{alias=~'$alias.*'} - node_memory_PageTables{alias=~'$alias.*'} - node_memory_VmallocUsed{alias=~'$alias.*'} )",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Apps",
          "metric": "",
          "refId": "A",
          "step": 1200,
          "target": ""
        },
        {
          "expr": "node_memory_Buffers_bytes{alias=~'$alias.*'} or node_memory_Buffers{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Buffers",
          "refId": "B",
          "step": 1200
        },
        {
          "expr": "node_memory_Cached_bytes{alias=~'$alias.*'} or node_memory_Cached{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Cached",
          "refId": "D",
          "step": 1200
        },
        {
          "expr": "node_memory_MemFree_bytes{alias=~'$alias.*'} or node_memory_MemFree{alias=~'$alias.*'}",
          "hide": false,
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Free",
          "refId": "E",
          "step": 1200
        },
        {
          "expr": "node_memory_Slab_bytes{alias=~'$alias.*'} or node_memory_Slab{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Slab",
          "refId": "F",
          "step": 1200
        },
        {
          "expr": "node_memory_SwapCached_bytes{alias=~'$alias.*'} or node_memory_SwapCached{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "SwapCached",
          "refId": "G",
          "step": 1200
        },
        {
          "expr": "node_memory_PageTables_bytes{alias=~'$alias.*'} or node_memory_PageTables{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "PageTables",
          "refId": "H",
          "step": 1200
        },
        {
          "expr": "node_memory_VmallocUsed_bytes{alias=~'$alias.*'} or node_memory_VmallocUsed{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "VmallocUsed",
          "metric": "",
          "refId": "I",
          "step": 1200
        },
        {
          "expr": "(node_memory_SwapTotal_bytes{alias=~'$alias.*'} - node_memory_SwapFree{alias=~'$alias.*'}) or (node_memory_SwapTotal{alias=~'$alias.*'} - node_memory_SwapFree{alias=~'$alias.*'})",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Swap",
          "metric": "",
          "refId": "C",
          "step": 1200
        },
        {
          "expr": "node_memory_Committed_AS_bytes{alias=~'$alias.*'} or node_memory_Committed_AS{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Committed",
          "metric": "",
          "refId": "J",
          "step": 1200
        },
        {
          "expr": "node_memory_Mapped_bytes{alias=~'$alias.*'} or node_memory_Mapped{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Mapped",
          "refId": "K",
          "step": 1200
        },
        {
          "expr": "node_memory_Active_bytes{alias=~'$alias.*'} or node_memory_Active{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Active",
          "metric": "",
          "refId": "L",
          "step": 1200
        },
        {
          "expr": "node_memory_Inactive_bytes{alias=~'$alias.*'} or node_memory_Inactive{alias=~'$alias.*'}",
          "interval": "",
          "intervalFactor": 2,
          "legendFormat": "Inactive",
          "metric": "",
          "refId": "M",
          "step": 1200
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Memory on $alias",
      "tooltip": {
        "msResolution": false,
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bytes",
          "label": "GB",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 20,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(nginx_http_request_cache_total, alias)",
        "hide": 0,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "alias",
        "options": [],
        "query": "label_values(nginx_http_request_cache_total, alias)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "label_values(node_exporter_build_info, class)",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "Cache health",
  "uid": "p21-cvJWk",
  "version": 16
}