Grafana dashboard: HPE CSI Driver for Kubernetes Namespace Explorer
Description: Provides an overview of a Namespace from a HPE CSI Driver for Kubernetes perspective.

This dashboard enumerates `PersistentVolumeClaims` in a Kubernetes Namespace and provide drill-down capabilities.

# Requirements

HPE CSI Info Metrics Provider for Kubernetes deployed on the cluster with a "cluster" target label designating a cluster name. The source metrics needs to be normalized with the following `metric_relabel_configs` for the scrape target.

```
metric_relabel_configs:
  - source_labels: [__name__]
    action: labelmap
    regex: "cpg|pool"
    replacement: "storagepool"
  - source_labels: [__name__]
    regex: "^hpe(primera|nimble|3par|alletra6000|alletra9000)_(.*)"
    target_label: "__name__"
    replacement: "hpe_$2"
  - source_labels: [__name__]
    regex: "^hpe_(pool|cpg)_(.*)"
    target_label: "__name__"
    replacement: "hpe_storagepool_$2"
```

## HPE Storage Array Exporter for Prometheus 
- Scrape target label named "array" with the storage array name or designation.
- Requires the following drill-down dashboards to function properly:
  - [HPE Storage Arrays](https://grafana.com/grafana/dashboards/14836)
  - [HPE Storage Pools](https://grafana.com/grafana/dashboards/14907)
  - [HPE Storage Array Details](https://grafana.com/grafana/dashboards/14908)
  - [HPE Storage Volumes](https://grafana.com/grafana/dashboards/14909)
  - [HPE Storage Volume Details](https://grafana.com/grafana/dashboards/14910)

# Resources

This dashboard utilize the officially supported exporters for HPE storage systems.

- [HPE CSI Info Metrics Provider for Prometheus](https://scod.hpedev.io/csi_driver/metrics.html)
- [HPE Storage Array Exporter for Prometheus](https://hpe-storage.github.io/array-exporter/)

# Support

This dashboard is provided, as-is, as an example and it's not officially supported by HPE. Join us on Slack at [slack.hpedev.io](https://slack.hpedev.io) in the storage platform channels if you have questions or feedback.

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.1.2"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "Provides an overview of a Namespace from a HPE CSI Driver for Kubernetes perspective.",
  "editable": true,
  "gnetId": 14905,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1631671861753,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": false,
      "keepTime": true,
      "tags": [
        "HPE Storage Arrays"
      ],
      "targetBlank": false,
      "title": "HPE Storage Arrays",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    },
    {
      "asDropdown": false,
      "icon": "dashboard",
      "includeVars": true,
      "keepTime": true,
      "tags": [
        "HPE Storage Pools"
      ],
      "targetBlank": false,
      "title": "HPE Storage Pools",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    }
  ],
  "panels": [
    {
      "datasource": null,
      "gridPos": {
        "h": 2,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 28,
      "options": {
        "content": "**Tip:** Click the IOPS line graph and select **Volume Details** for additional volume metrics.            ",
        "mode": "markdown"
      },
      "pluginVersion": "8.1.2",
      "transparent": true,
      "type": "text"
    },
    {
      "datasource": null,
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "links": [],
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "iops"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "IOPS"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "purple",
                  "mode": "fixed"
                }
              },
              {
                "id": "links",
                "value": [
                  {
                    "title": "Volume Details",
                    "url": "d/LT7Nnk7nk?var-volume=${__field.labels.volume}&${__all_variables}&var-array=${__field.labels.array}&${__url_time_range}&var-pool=${__field.labels.storagepool}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Latency (avg. read/write)"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "yellow",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Capacity"
            },
            "properties": [
              {
                "id": "custom.fillOpacity",
                "value": 10
              },
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 6,
        "x": 0,
        "y": 2
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.0.5",
      "repeat": "pvc",
      "repeatDirection": "h",
      "targets": [
        {
          "exemplar": true,
          "expr": "hpestoragecsi_volume_info{pvc_name=\"$pvc\", pvc_namespace=\"$namespace\", cluster=\"$cluster\"} * on (volume) group_left (array, storagepool) hpe_volume_reads_per_second_avg5m +\nhpestoragecsi_volume_info{pvc_name=\"$pvc\", pvc_namespace=\"$namespace\", cluster=\"$cluster\"} * on (volume) group_left (array, storagepool) hpe_volume_writes_per_second_avg5m  ",
          "interval": "",
          "legendFormat": "IOPS",
          "refId": "A"
        },
        {
          "exemplar": true,
          "expr": "kubelet_volume_stats_used_bytes{namespace=\"$namespace\", persistentvolumeclaim=\"$pvc\"} / kubelet_volume_stats_capacity_bytes{namespace=\"$namespace\", persistentvolumeclaim=\"$pvc\"}",
          "hide": false,
          "interval": "",
          "legendFormat": "Capacity",
          "refId": "C"
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "$pvc",
      "type": "timeseries"
    }
  ],
  "refresh": "",
  "schemaVersion": 30,
  "style": "dark",
  "tags": [
    "HPE CSI Driver for Kubernetes"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(hpestoragecsi_backend_info, cluster)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "cluster",
        "multi": false,
        "name": "cluster",
        "options": [],
        "query": {
          "query": "label_values(hpestoragecsi_backend_info, cluster)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(hpestoragecsi_volume_info, pvc_namespace)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Namespace",
        "multi": false,
        "name": "namespace",
        "options": [],
        "query": {
          "query": "label_values(hpestoragecsi_volume_info, pvc_namespace)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(hpestoragecsi_volume_info{pvc_namespace=\"$namespace\"}, pvc_name)",
        "description": null,
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "PVC",
        "multi": true,
        "name": "pvc",
        "options": [],
        "query": {
          "query": "label_values(hpestoragecsi_volume_info{pvc_namespace=\"$namespace\"}, pvc_name)",
          "refId": "StandardVariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "HPE CSI Driver for Kubernetes Namespace Explorer",
  "uid": "SjOZKt7nz",
  "version": 53
}