# helm_charts_persistentvolumesusage.yaml
{{- /*
Generated from 'persistentvolumesusage' from https://raw.githubusercontent.com/coreos/kube-prometheus/master/manifests/grafana-dashboardDefinitions.yaml
Do not change in-place! In order to change this file first read following link:
https://github.com/helm/charts/tree/master/stable/prometheus-operator/hack
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.enabled .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ template "prometheus-operator.namespace" . }}
  name: {{ printf "%s-%s" (include "prometheus-operator.fullname" $) "persistentvolumesusage" | trunc 63 | trimSuffix "-" }}
  annotations:
{{ toYaml .Values.grafana.sidecar.dashboards.annotations | indent 4 }}
  labels:
    {{- if $.Values.grafana.sidecar.dashboards.label }}
    {{ $.Values.grafana.sidecar.dashboards.label }}: "1"
    {{- end }}
    app: {{ template "prometheus-operator.name" $ }}-grafana
{{ include "prometheus-operator.labels" $ | indent 4 }}
data:
  persistentvolumesusage.json: |-
    {
        "__inputs": [

        ],
        "__requires": [

        ],
        "annotations": {
            "list": [

            ]
        },
        "editable": false,
        "gnetId": null,
        "graphTooltip": 0,
        "hideControls": false,
        "id": null,
        "links": [

        ],
        "refresh": "10s",
        "rows": [
            {
                "collapse": false,
                "collapsed": false,
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 1,
                        "gridPos": {

                        },
                        "id": 2,
                        "legend": {
                            "alignAsTable": true,
                            "avg": true,
                            "current": true,
                            "max": true,
                            "min": true,
                            "rightSide": false,
                            "show": true,
                            "sideWidth": null,
                            "total": false,
                            "values": true
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

                        ],
                        "nullPointMode": "null",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "repeat": null,
                        "seriesOverrides": [

                        ],
                        "spaceLength": 10,
                        "span": 9,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "(\n  sum without(instance, node) (kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n  -\n  sum without(instance, node) (kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n)\n",
                                "format": "time_series",
                                "intervalFactor": 1,
                                "legendFormat": "Used Space",
                                "refId": "A"
                            },
                            {
                                "expr": "sum without(instance, node) (kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n",
                                "format": "time_series",
                                "intervalFactor": 1,
                                "legendFormat": "Free Space",
                                "refId": "B"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Volume Space Usage",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "bytes",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "bytes",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            }
                        ]
                    },
                    {
                        "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": "$datasource",
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "gridPos": {

                        },
                        "id": 3,
                        "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": "50%",
                        "prefix": "",
                        "prefixFontSize": "50%",
                        "rangeMaps": [
                            {
                                "from": "null",
                                "text": "N/A",
                                "to": "null"
                            }
                        ],
                        "span": 3,
                        "sparkline": {
                            "fillColor": "rgba(31, 118, 189, 0.18)",
                            "full": false,
                            "lineColor": "rgb(31, 120, 193)",
                            "show": false
                        },
                        "tableColumn": "",
                        "targets": [
                            {
                                "expr": "(\n  kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n  -\n  kubelet_volume_stats_available_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n)\n/\nkubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n* 100\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "",
                                "refId": "A"
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Volume Space Usage",
                        "tooltip": {
                            "shared": false
                        },
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": false,
                "title": "Dashboard Row",
                "titleSize": "h6",
                "type": "row"
            },
            {
                "collapse": false,
                "collapsed": false,
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 1,
                        "gridPos": {

                        },
                        "id": 4,
                        "legend": {
                            "alignAsTable": true,
                            "avg": true,
                            "current": true,
                            "max": true,
                            "min": true,
                            "rightSide": false,
                            "show": true,
                            "sideWidth": null,
                            "total": false,
                            "values": true
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

                        ],
                        "nullPointMode": "null",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "repeat": null,
                        "seriesOverrides": [

                        ],
                        "spaceLength": 10,
                        "span": 9,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "sum without(instance, node) (kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n",
                                "format": "time_series",
                                "intervalFactor": 1,
                                "legendFormat": "Used inodes",
                                "refId": "A"
                            },
                            {
                                "expr": "(\n  sum without(instance, node) (kubelet_volume_stats_inodes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n  -\n  sum without(instance, node) (kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"})\n)\n",
                                "format": "time_series",
                                "intervalFactor": 1,
                                "legendFormat": " Free inodes",
                                "refId": "B"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Volume inodes Usage",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "none",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "none",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            }
                        ]
                    },
                    {
                        "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": "$datasource",
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "gridPos": {

                        },
                        "id": 5,
                        "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": "50%",
                        "prefix": "",
                        "prefixFontSize": "50%",
                        "rangeMaps": [
                            {
                                "from": "null",
                                "text": "N/A",
                                "to": "null"
                            }
                        ],
                        "span": 3,
                        "sparkline": {
                            "fillColor": "rgba(31, 118, 189, 0.18)",
                            "full": false,
                            "lineColor": "rgb(31, 120, 193)",
                            "show": false
                        },
                        "tableColumn": "",
                        "targets": [
                            {
                                "expr": "kubelet_volume_stats_inodes_used{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n/\nkubelet_volume_stats_inodes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\", persistentvolumeclaim=\"$volume\"}\n* 100\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "",
                                "refId": "A"
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Volume inodes Usage",
                        "tooltip": {
                            "shared": false
                        },
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": false,
                "title": "Dashboard Row",
                "titleSize": "h6",
                "type": "row"
            }
        ],
        "schemaVersion": 14,
        "style": "dark",
        "tags": [
            "kubernetes-mixin"
        ],
        "templating": {
            "list": [
                {
                    "current": {
                        "text": "default",
                        "value": "default"
                    },
                    "hide": 0,
                    "label": null,
                    "name": "datasource",
                    "options": [

                    ],
                    "query": "prometheus",
                    "refresh": 1,
                    "regex": "",
                    "type": "datasource"
                },
                {
                    "allValue": null,
                    "current": {

                    },
                    "datasource": "$datasource",
                    "hide": 2,
                    "includeAll": false,
                    "label": "cluster",
                    "multi": false,
                    "name": "cluster",
                    "options": [

                    ],
                    "query": "label_values(kubelet_volume_stats_capacity_bytes, cluster)",
                    "refresh": 2,
                    "regex": "",
                    "sort": 1,
                    "tagValuesQuery": "",
                    "tags": [

                    ],
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": false
                },
                {
                    "allValue": null,
                    "current": {

                    },
                    "datasource": "$datasource",
                    "hide": 0,
                    "includeAll": false,
                    "label": "Namespace",
                    "multi": false,
                    "name": "namespace",
                    "options": [

                    ],
                    "query": "label_values(kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\"}, namespace)",
                    "refresh": 2,
                    "regex": "",
                    "sort": 1,
                    "tagValuesQuery": "",
                    "tags": [

                    ],
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": false
                },
                {
                    "allValue": null,
                    "current": {

                    },
                    "datasource": "$datasource",
                    "hide": 0,
                    "includeAll": false,
                    "label": "PersistentVolumeClaim",
                    "multi": false,
                    "name": "volume",
                    "options": [

                    ],
                    "query": "label_values(kubelet_volume_stats_capacity_bytes{cluster=\"$cluster\", job=\"kubelet\", metrics_path=\"/metrics\", namespace=\"$namespace\"}, persistentvolumeclaim)",
                    "refresh": 2,
                    "regex": "",
                    "sort": 1,
                    "tagValuesQuery": "",
                    "tags": [

                    ],
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": false
                }
            ]
        },
        "time": {
            "from": "now-7d",
            "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": "UTC",
        "title": "Kubernetes / Persistent Volumes",
        "uid": "919b92a8e8041bd567af9edab12c840c",
        "version": 0
    }
{{- end }}