{{- /*
Generated from 'k8s-node-rsrc-use' from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/release-0.1/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 (semverCompare ">=1.10.0-0" $kubeTargetVersion) (semverCompare "<1.14.0-0" $kubeTargetVersion) .Values.grafana.enabled .Values.grafana.defaultDashboardsEnabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ template "kube-prometheus-stack.namespace" . }}
  name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "k8s-node-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:
  k8s-node-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": 1,
                        "id": 1,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_cpu_utilisation:avg1m{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Utilisation",
                                "legendLink": null,
                                "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": null,
                                "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": 1,
                        "id": 2,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_cpu_saturation_load1:{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Saturation",
                                "legendLink": null,
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "CPU Saturation (Load1)",
                        "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": 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": "CPU",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_memory_utilisation:{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Memory",
                                "legendLink": null,
                                "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": null,
                                "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": 1,
                        "id": 4,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_memory_swap_io_bytes:sum_rate{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Swap IO",
                                "legendLink": null,
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Memory Saturation (Swap I/O)",
                        "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": 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": 1,
                        "id": 5,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_disk_utilisation:avg_irate{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Utilisation",
                                "legendLink": null,
                                "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": null,
                                "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": 1,
                        "id": 6,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_disk_saturation:avg_irate{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Saturation",
                                "legendLink": null,
                                "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": 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": "Disk",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_net_utilisation:sum_irate{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Utilisation",
                                "legendLink": null,
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Net Utilisation (Transmitted)",
                        "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": 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": 1,
                        "id": 8,
                        "legend": {
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "show": true,
                            "total": false,
                            "values": false
                        },
                        "lines": true,
                        "linewidth": 1,
                        "links": [

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_net_saturation:sum_irate{cluster=\"$cluster\", node=\"$node\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "Saturation",
                                "legendLink": null,
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Net Saturation (Dropped)",
                        "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": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": false
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": true,
                "title": "Net",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "250px",
                "panels": [
                    {
                        "aliasColors": {

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

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

                        ],
                        "spaceLength": 10,
                        "span": 12,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node:node_filesystem_usage:{cluster=\"$cluster\"}\n* on (namespace, pod) group_left (node) node_namespace_pod:kube_pod_info:{cluster=\"$cluster\", node=\"$node\"}\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}}",
                                "legendLink": null,
                                "step": 10
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Disk 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": 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": "Disk",
                "titleSize": "h6"
            }
        ],
        "schemaVersion": 14,
        "style": "dark",
        "tags": [
            "kubernetes-mixin"
        ],
        "templating": {
            "list": [
                {
                    "current": {
                        "text": "Prometheus",
                        "value": "Prometheus"
                    },
                    "hide": 0,
                    "label": null,
                    "name": "datasource",
                    "options": [

                    ],
                    "query": "prometheus",
                    "refresh": 1,
                    "regex": "",
                    "type": "datasource"
                },
                {
                    "allValue": null,
                    "current": {
                        "text": "prod",
                        "value": "prod"
                    },
                    "datasource": "$datasource",
                    "hide": {{ if .Values.grafana.sidecar.dashboards.multicluster }}0{{ else }}2{{ end }},
                    "includeAll": false,
                    "label": "cluster",
                    "multi": false,
                    "name": "cluster",
                    "options": [

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

                    ],
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": false
                },
                {
                    "allValue": null,
                    "current": {
                        "text": "prod",
                        "value": "prod"
                    },
                    "datasource": "$datasource",
                    "hide": 0,
                    "includeAll": false,
                    "label": "node",
                    "multi": false,
                    "name": "node",
                    "options": [

                    ],
                    "query": "label_values(kube_node_info{cluster=\"$cluster\"}, node)",
                    "refresh": 1,
                    "regex": "",
                    "sort": 2,
                    "tagValuesQuery": "",
                    "tags": [

                    ],
                    "tagsQuery": "",
                    "type": "query",
                    "useTags": false
                }
            ]
        },
        "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": "",
        "title": "Kubernetes / USE Method / Node",
        "uid": "4ac4f123aae0ff6dbaf4f4f66120033b",
        "version": 0
    }
{{- end }}