{{- /*
Generated from 'nodes' from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/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 }}
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: {{ .Values.grafana.defaultDashboards.namespace }}
  name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" $) "nodes" | 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:
  nodes.json: |-
    {
        "__inputs": [

        ],
        "__requires": [

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

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

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

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

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "(\n  (1 - rate(node_cpu_seconds_total{job=\"node-exporter\", mode=\"idle\", instance=\"$instance\"}[$__rate_interval]))\n/ ignoring(cpu) group_left\n  count without (cpu)( node_cpu_seconds_total{job=\"node-exporter\", mode=\"idle\", instance=\"$instance\"})\n)\n",
                                "format": "time_series",
                                "intervalFactor": 5,
                                "legendFormat": "{{`{{`}}cpu{{`}}`}}",
                                "refId": "A"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "CPU Usage",
                        "tooltip": {
                            "shared": true,
                            "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": "percentunit",
                                "label": null,
                                "logBase": 1,
                                "max": 1,
                                "min": 0,
                                "show": true
                            }
                        ]
                    },
                    {
                        "aliasColors": {

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

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "node_load1{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "1m load average",
                                "refId": "A"
                            },
                            {
                                "expr": "node_load5{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "5m load average",
                                "refId": "B"
                            },
                            {
                                "expr": "node_load15{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "15m load average",
                                "refId": "C"
                            },
                            {
                                "expr": "count(node_cpu_seconds_total{job=\"node-exporter\", instance=\"$instance\", mode=\"idle\"})",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "logical cores",
                                "refId": "D"
                            }
                        ],
                        "thresholds": [

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

                            ]
                        },
                        "yaxes": [
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            },
                            {
                                "format": "short",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": 0,
                                "show": true
                            }
                        ]
                    }
                ],
                "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,
                        "fillGradient": 0,
                        "gridPos": {

                        },
                        "id": 4,
                        "legend": {
                            "alignAsTable": false,
                            "avg": false,
                            "current": false,
                            "max": false,
                            "min": false,
                            "rightSide": false,
                            "show": true,
                            "sideWidth": null,
                            "total": false,
                            "values": false
                        },
                        "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  node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\"}\n-\n  node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\"}\n-\n  node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\"}\n-\n  node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\"}\n)\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "memory used",
                                "refId": "A"
                            },
                            {
                                "expr": "node_memory_Buffers_bytes{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "memory buffers",
                                "refId": "B"
                            },
                            {
                                "expr": "node_memory_Cached_bytes{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "memory cached",
                                "refId": "C"
                            },
                            {
                                "expr": "node_memory_MemFree_bytes{job=\"node-exporter\", instance=\"$instance\"}",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "memory free",
                                "refId": "D"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Memory Usage",
                        "tooltip": {
                            "shared": true,
                            "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": 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": "100 -\n(\n  avg(node_memory_MemAvailable_bytes{job=\"node-exporter\", instance=\"$instance\"})\n/\n  avg(node_memory_MemTotal_bytes{job=\"node-exporter\", instance=\"$instance\"})\n* 100\n)\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "",
                                "refId": "A"
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Memory Usage",
                        "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": 0,
                        "fillGradient": 0,
                        "gridPos": {

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

                        ],
                        "nullPointMode": "null",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "repeat": null,
                        "seriesOverrides": [
                            {
                                "alias": "/ read| written/",
                                "yaxis": 1
                            },
                            {
                                "alias": "/ io time/",
                                "yaxis": 2
                            }
                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "rate(node_disk_read_bytes_total{job=\"node-exporter\", instance=\"$instance\", device=~\"mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|dasd.+\"}[$__rate_interval])",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}} read",
                                "refId": "A"
                            },
                            {
                                "expr": "rate(node_disk_written_bytes_total{job=\"node-exporter\", instance=\"$instance\", device=~\"mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|dasd.+\"}[$__rate_interval])",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}} written",
                                "refId": "B"
                            },
                            {
                                "expr": "rate(node_disk_io_time_seconds_total{job=\"node-exporter\", instance=\"$instance\", device=~\"mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|dasd.+\"}[$__rate_interval])",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}} io time",
                                "refId": "C"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Disk I/O",
                        "tooltip": {
                            "shared": true,
                            "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": null,
                                "show": true
                            },
                            {
                                "format": "s",
                                "label": null,
                                "logBase": 1,
                                "max": null,
                                "min": null,
                                "show": true
                            }
                        ]
                    },
                    {
                        "aliasColors": {

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

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

                        ],
                        "nullPointMode": "null",
                        "percentage": false,
                        "pointradius": 5,
                        "points": false,
                        "renderer": "flot",
                        "repeat": null,
                        "seriesOverrides": [
                            {
                                "alias": "used",
                                "color": "#E0B400"
                            },
                            {
                                "alias": "available",
                                "color": "#73BF69"
                            }
                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": true,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "sum(\n  max by (device) (\n    node_filesystem_size_bytes{job=\"node-exporter\", instance=\"$instance\", fstype!=\"\"}\n  -\n    node_filesystem_avail_bytes{job=\"node-exporter\", instance=\"$instance\", fstype!=\"\"}\n  )\n)\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "used",
                                "refId": "A"
                            },
                            {
                                "expr": "sum(\n  max by (device) (\n    node_filesystem_avail_bytes{job=\"node-exporter\", instance=\"$instance\", fstype!=\"\"}\n  )\n)\n",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "available",
                                "refId": "B"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Disk Space Usage",
                        "tooltip": {
                            "shared": true,
                            "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
                            }
                        ]
                    }
                ],
                "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": 0,
                        "fillGradient": 0,
                        "gridPos": {

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "rate(node_network_receive_bytes_total{job=\"node-exporter\", instance=\"$instance\", device!=\"lo\"}[$__rate_interval])",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}}",
                                "refId": "A"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Network Received",
                        "tooltip": {
                            "shared": true,
                            "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
                            }
                        ]
                    },
                    {
                        "aliasColors": {

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

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

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

                        ],
                        "spaceLength": 10,
                        "span": 6,
                        "stack": false,
                        "steppedLine": false,
                        "targets": [
                            {
                                "expr": "rate(node_network_transmit_bytes_total{job=\"node-exporter\", instance=\"$instance\", device!=\"lo\"}[$__rate_interval])",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "{{`{{`}}device{{`}}`}}",
                                "refId": "A"
                            }
                        ],
                        "thresholds": [

                        ],
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Network Transmitted",
                        "tooltip": {
                            "shared": true,
                            "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
                            }
                        ]
                    }
                ],
                "repeat": null,
                "repeatIteration": null,
                "repeatRowId": null,
                "showTitle": false,
                "title": "Dashboard Row",
                "titleSize": "h6",
                "type": "row"
            }
        ],
        "schemaVersion": 14,
        "style": "dark",
        "tags": [
            "node-exporter-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": {

                    },
                    "datasource": "$datasource",
                    "hide": 0,
                    "includeAll": false,
                    "label": null,
                    "multi": false,
                    "name": "instance",
                    "options": [

                    ],
                    "query": "label_values(node_exporter_build_info{job=\"node-exporter\"}, instance)",
                    "refresh": 2,
                    "regex": "",
                    "sort": 0,
                    "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": "{{ .Values.grafana.defaultDashboardsTimezone }}",
        "title": "Node Exporter / Nodes",
        "version": 0
    }
{{- end }}