{{- /*
Generated from 'node-cluster-rsrc-use' from https://raw.githubusercontent.com/prometheus-operator/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/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack
*/ -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if and (or .Values.grafana.enabled .Values.grafana.forceDeployDashboards) (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.grafana.defaultDashboardsEnabled .Values.nodeExporter.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ .Values.grafana.defaultDashboards.namespace }}
  name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "node-cluster-rsrc-use" | 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 "kube-prometheus-stack.name" $ }}-grafana
{{ include "kube-prometheus-stack.labels" $ | indent 4 }}
data:
  node-cluster-rsrc-use.json: |-
    {
        "annotations": {
            "list": [

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

        ],
        "refresh": "10s",
        "rows": [
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 1,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "(\n  instance:node_cpu_utilisation:rate5m{job=\"node-exporter\"}\n*\n  instance:node_num_cpu:sum{job=\"node-exporter\"}\n)\n/ scalar(sum(instance:node_num_cpu:sum{job=\"node-exporter\"}))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    },
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 2,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance:node_load1_per_cpu:ratio{job=\"node-exporter\"}\n/ scalar(count(instance:node_load1_per_cpu:ratio{job=\"node-exporter\"}))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "CPU Saturation (load1 per CPU)",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "CPU",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 3,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance:node_memory_utilisation:ratio{job=\"node-exporter\"}\n/ scalar(count(instance:node_memory_utilisation:ratio{job=\"node-exporter\"}))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    },
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 4,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance:node_vmstat_pgmajfault:rate5m{job=\"node-exporter\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Memory Saturation (Major Page Faults)",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "rps",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "Memory",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 5,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

                        ],
                        "nullPointMode": "null as zero",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "seriesOverrides": [
                            {
                                "alias": "/ Receive/",
                                "stack": "A"
                            },
                            {
                                "alias": "/ Transmit/",
                                "stack": "B",
                                "transform": "negative-Y"
                            }
                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance:node_network_receive_bytes_excluding_lo:rate5m{job=\"node-exporter\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} Receive",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            },
                            {
                                "expr": "instance:node_network_transmit_bytes_excluding_lo:rate5m{job=\"node-exporter\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} Transmit",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Net Utilisation (Bytes Receive/Transmit)",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "Bps",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    },
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 6,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

                        ],
                        "nullPointMode": "null as zero",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "seriesOverrides": [
                            {
                                "alias": "/ Receive/",
                                "stack": "A"
                            },
                            {
                                "alias": "/ Transmit/",
                                "stack": "B",
                                "transform": "negative-Y"
                            }
                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance:node_network_receive_drop_excluding_lo:rate5m{job=\"node-exporter\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} Receive",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            },
                            {
                                "expr": "instance:node_network_transmit_drop_excluding_lo:rate5m{job=\"node-exporter\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} Transmit",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Net Saturation (Drops Receive/Transmit)",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
                        "type": "graph",
                        "xaxis": {
                            "buckets": null,
                            "mode": "time",
                            "name": null,
                            "show": true,
                            "values": [

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "rps",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "Network",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 7,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance_device:node_disk_io_time_seconds:rate5m{job=\"node-exporter\"}\n/ scalar(count(instance_device:node_disk_io_time_seconds:rate5m{job=\"node-exporter\"}))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} {{`{{`}}device{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    },
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 8,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "instance_device:node_disk_io_time_weighted_seconds:rate5m{job=\"node-exporter\"}\n/ scalar(count(instance_device:node_disk_io_time_weighted_seconds:rate5m{job=\"node-exporter\"}))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}} {{`{{`}}device{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "Disk IO",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

                        },
                        "bars": false,
                        "dashLength": 10,
                        "dashes": false,
                        "datasource": "$datasource",
                        "fill": 10,
                        "id": 9,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 0,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 12,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "sum without (device) (\n  max without (fstype, mountpoint) (\n    node_filesystem_size_bytes{job=\"node-exporter\", fstype!=\"\"} - node_filesystem_avail_bytes{job=\"node-exporter\", fstype!=\"\"}\n  )\n) \n/ scalar(sum(max without (fstype, mountpoint) (node_filesystem_size_bytes{job=\"node-exporter\", fstype!=\"\"})))\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}instance{{`}}`}}",
                                "legendLink": "/dashboard/file/node-rsrc-use.json",
                                "step": 10
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "Disk Space",
                "titleSize": "h6"
            }
        ],
        "schemaVersion": 14,
        "style": "dark",
        "tags": [

        ],
        "templating": {
            "list": [
                {
                    "current": {
                        "text": "default",
                        "value": "default"
                    },
                    "hide": 0,
                    "label": null,
                    "name": "datasource",
                    "options": [

                    ],
                    "query": "prometheus",
                    "refresh": 1,
                    "regex": "",
                    "type": "datasource"
                }
            ]
        },
        "time": {
            "from": "now-1h",
            "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": "USE Method / Cluster",
        "uid": "",
        "version": 0
    }
{{- end }}