kind: ConfigMap
apiVersion: v1
metadata:
  name: kubernetes-pvc-dashboard
  namespace: open-cluster-management-observability
  labels:
    grafana-custom-dashboard: "true"
data:
  sample.yaml: |-
    {
      "annotations": {
        "list": [
          {
            "$$hashKey": "object:93",
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "description": "",
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "id": 10,
      "iteration": 1533213184361,
      "links": [],
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "rgba(237, 129, 40, 0.89)",
            "#d44a3a"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 6,
            "w": 6,
            "x": 0,
            "y": 0
          },
          "id": 6,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "sum((((kubelet_volume_stats_capacity_bytes-kubelet_volume_stats_available_bytes) / kubelet_volume_stats_capacity_bytes)*100)>bool $capacity)",
              "format": "time_series",
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Number of PVCs > $capacity% Used",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "No PVCs using > $capacity% capacity",
              "value": "0"
            }
          ],
          "valueName": "avg"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 6,
            "w": 9,
            "x": 6,
            "y": 0
          },
          "hideTimeOverride": false,
          "id": 15,
          "links": [],
          "options": {},
          "pageSize": null,
          "repeat": null,
          "repeatDirection": "h",
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 12,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "hidden"
            },
            {
              "alias": "PVC",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "persistentvolumeclaim",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "% Used",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 1,
              "pattern": "Value",
              "thresholds": [],
              "type": "number",
              "unit": "percent"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "hidden",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "expr": "((kubelet_volume_stats_capacity_bytes-kubelet_volume_stats_available_bytes) / kubelet_volume_stats_capacity_bytes * 100)>$capacity",
              "format": "table",
              "instant": true,
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "title": "List of PVCs > $capacity% used",
          "transform": "table",
          "type": "table"
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#299c46",
            "rgba(237, 129, 40, 0.89)",
            "#d44a3a"
          ],
          "datasource": "$datasource",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 6,
            "w": 6,
            "x": 0,
            "y": 6
          },
          "id": 13,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "sum(kube_persistentvolumeclaim_status_phase{phase=\"Bound\"}!=bool 1)",
              "format": "time_series",
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "thresholds": "1,1",
          "title": "Number of Unbound PVCs",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "No unbound PVCs",
              "value": "0"
            }
          ],
          "valueName": "avg"
        },
        {
          "columns": [],
          "datasource": "$datasource",
          "fontSize": "100%",
          "gridPos": {
            "h": 6,
            "w": 9,
            "x": 6,
            "y": 6
          },
          "id": 17,
          "links": [],
          "options": {},
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 11,
            "desc": true
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "pattern": "Time",
              "type": "hidden"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "",
              "thresholds": [],
              "type": "number",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "decimals": 2,
              "pattern": "persistentvolumeclaim",
              "thresholds": [],
              "type": "string",
              "unit": "short"
            },
            {
              "alias": "",
              "colorMode": null,
              "colors": [
                "rgba(245, 54, 54, 0.9)",
                "rgba(237, 129, 40, 0.89)",
                "rgba(50, 172, 45, 0.97)"
              ],
              "decimals": 2,
              "pattern": "/.*/",
              "thresholds": [],
              "type": "hidden",
              "unit": "short"
            }
          ],
          "targets": [
            {
              "expr": "kube_persistentvolumeclaim_status_phase{phase=\"Bound\", namespace=\"open-cluster-management-observability\"}!=1",
              "format": "table",
              "instant": true,
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "title": "Unbound PVCs",
          "transform": "table",
          "type": "table"
        }
      ],
      "refresh": false,
      "schemaVersion": 16,
      "style": "dark",
      "tags": [
        "persistent volumes",
        "kubernetes"
      ],
      "templating": {
        "list": [
          {
            "current": {
              "text": "Observatorium",
              "value": "Observatorium"
            },
            "hide": 2,
            "includeAll": false,
            "label": null,
            "multi": false,
            "name": "datasource",
            "options": [],
            "query": "prometheus",
            "refresh": 1,
            "regex": "",
            "skipUrlSync": false,
            "type": "datasource"
          },
          {
            "allValue": null,
            "current": {
              "text": "open-cluster-management-observability",
              "value": "open-cluster-management-observability"
            },
            "datasource": "$datasource",
            "hide": 0,
            "includeAll": false,
            "label": "Namespace",
            "multi": false,
            "name": "namespace",
            "options": [],
            "query": "label_values(kubelet_volume_stats_capacity_bytes, namespace)",
            "refresh": 1,
            "regex": "",
            "sort": 1,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          },
          {
            "allValue": null,
            "current": {
              "tags": [],
              "text": "50",
              "value": "50"
            },
            "hide": 0,
            "includeAll": false,
            "label": "Capacity",
            "multi": false,
            "name": "capacity",
            "options": [
              {
                "$$hashKey": "object:652",
                "selected": true,
                "text": "50",
                "value": "50"
              },
              {
                "$$hashKey": "object:653",
                "selected": false,
                "text": "60",
                "value": "60"
              },
              {
                "$$hashKey": "object:654",
                "selected": false,
                "text": "70",
                "value": "70"
              },
              {
                "$$hashKey": "object:655",
                "selected": false,
                "text": "80",
                "value": "80"
              },
              {
                "$$hashKey": "object:656",
                "selected": false,
                "text": "90",
                "value": "90"
              },
              {
                "$$hashKey": "object:657",
                "selected": false,
                "text": "95",
                "value": "95"
              }
            ],
            "query": "50,60,70,80,90,95",
            "type": "custom"
          }
        ]
      },
      "time": {
        "from": "now-24h",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ],
        "time_options": [
          "5m",
          "15m",
          "1h",
          "6h",
          "12h",
          "24h",
          "2d",
          "7d",
          "30d"
        ]
      },
      "timezone": "",
      "title": "Kubernetes Persistent Volumes",
      "uid": "KweC0j4mz",
      "version": 1898
    }
