---
apiVersion: v1
kind: ConfigMap
metadata:
  name: dashboard-cluster-status
  namespace: monitoring
  labels:
    grafana_dashboard: ""
data:
  cluster-status-dashboard.json: |
    {
     "__inputs": [],
      "__requires": [
        {
          "type": "grafana",
          "id": "grafana",
          "name": "Grafana",
          "version": "5.4.2"
        },
        {
          "type": "panel",
          "id": "graph",
          "name": "Graph",
          "version": "5.0.0"
        },
        {
          "type": "datasource",
          "id": "prometheus",
          "name": "Prometheus",
          "version": "5.0.0"
        },
        {
          "type": "panel",
          "id": "text",
          "name": "Text",
          "version": "5.0.0"
        }
      ],
        "annotations": {
            "list": []
        },
        "editable": true,
        "graphTooltip": 0,
        "hideControls": false,
        "links": [],
        "rows": [
            {
                "collapse": false,
                "height": "129px",
                "panels": [
                    {
                        "colorBackground": false,
                        "colorValue": true,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "none",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": false,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 5,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "postfixFontSize": "50%",
                        "prefix": "",
                        "prefixFontSize": "50%",
                        "rangeMaps": [
                            {
                                "from": "null",
                                "text": "N/A",
                                "to": "null"
                            }
                        ],
                        "span": 6,
                        "sparkline": {
                            "fillColor": "rgba(31, 118, 189, 0.18)",
                            "full": false,
                            "lineColor": "rgb(31, 120, 193)",
                            "show": false
                        },
                        "targets": [
                            {
                                "expr": "sum(up{job=~\"apiserver|kube-scheduler|kube-controller-manager\"} == 0)",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "1, 3",
                        "title": "Control Plane UP",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "UP",
                                "value": "null"
                            }
                        ],
                        "valueName": "total"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": true,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "none",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": false,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 6,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "postfixFontSize": "50%",
                        "prefix": "",
                        "prefixFontSize": "50%",
                        "rangeMaps": [
                            {
                                "from": "null",
                                "text": "N/A",
                                "to": "null"
                            }
                        ],
                        "span": 6,
                        "sparkline": {
                            "fillColor": "rgba(31, 118, 189, 0.18)",
                            "full": false,
                            "lineColor": "rgb(31, 120, 193)",
                            "show": false
                        },
                        "targets": [
                            {
                                "expr": "sum(kube_node_status_condition{condition=\"Ready\",status!=\"true\"})",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "",
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "1, 3",
                        "title": "Node Not Ready",
                        "transparent": false,
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    }
                ],
                "showTitle": true,
                "title": "Cluster Health",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "168px",
                "panels": [
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 1,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "(sum(up{job=\"apiserver\"} == 1) / count(up{job=\"apiserver\"})) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "50, 80",
                        "title": "API Servers UP",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 2,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "(sum(up{job=\"kube-controller-manager\"} == 1) / count(up{job=\"kube-controller-manager\"})) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "50, 80",
                        "title": "Controller Managers UP",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(245, 54, 54, 0.9)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(50, 172, 45, 0.97)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 3,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "(sum(up{job=\"kube-scheduler\"} == 1) / count(up{job=\"kube-scheduler\"})) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "50, 80",
                        "title": "Schedulers UP",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "current"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "hideTimeOverride": false,
                        "id": 4,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "max(sum by(instance) (rate(apiserver_request_count{code=~\"5..\"}[5m])) / sum by(instance) (rate(apiserver_request_count[5m]))) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "legendFormat": "",
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "5, 10",
                        "title": "API Server Request Error Rate",
                        "transparent": false,
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "0",
                                "value": "null"
                            }
                        ],
                        "valueName": "avg"
                    }
                ],
                "showTitle": true,
                "title": "Control Plane Status",
                "titleSize": "h6"
            },
            {
                "collapse": false,
                "height": "158px",
                "panels": [
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 8,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "sum(100 - (avg by (instance) (rate(node_cpu_seconds_total{job=\"node-exporter\",mode=\"idle\"}[5m])) * 100)) / count(node_cpu_seconds_total{job=\"node-exporter\",mode=\"idle\"})",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "CPU Utilization",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "avg"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 7,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "((sum(node_memory_MemTotal_bytes) - sum(node_memory_MemFree_bytes) - sum(node_memory_Buffers_bytes) - sum(node_memory_Cached_bytes)) / sum(node_memory_MemTotal_bytes)) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Memory Utilization",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "avg"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 9,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "max(1 - node_filesystem_avail_bytes{mountpoint=\"/\"} / node_filesystem_size_bytes{mountpoint=\"/\"})*100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Filesystem Utilization",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "avg"
                    },
                    {
                        "colorBackground": false,
                        "colorValue": false,
                        "colors": [
                            "rgba(50, 172, 45, 0.97)",
                            "rgba(237, 129, 40, 0.89)",
                            "rgba(245, 54, 54, 0.9)"
                        ],
                        "datasource": "Prometheus",
                        "editable": true,
                        "format": "percent",
                        "gauge": {
                            "maxValue": 100,
                            "minValue": 0,
                            "show": true,
                            "thresholdLabels": false,
                            "thresholdMarkers": true
                        },
                        "id": 10,
                        "links": [],
                        "mappingType": 1,
                        "mappingTypes": [
                            {
                                "name": "value to text",
                                "value": 1
                            },
                            {
                                "name": "range to text",
                                "value": 2
                            }
                        ],
                        "maxDataPoints": 100,
                        "nullPointMode": "connected",
                        "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
                        },
                        "targets": [
                            {
                                "expr": "100 - (sum(kube_node_status_capacity_pods) - sum(kube_pod_info)) / sum(kube_node_status_capacity_pods) * 100",
                                "format": "time_series",
                                "intervalFactor": 2,
                                "refId": "A",
                                "step": 600
                            }
                        ],
                        "thresholds": "80, 90",
                        "title": "Pod Utilization",
                        "type": "singlestat",
                        "valueFontSize": "80%",
                        "valueMaps": [
                            {
                                "op": "=",
                                "text": "N/A",
                                "value": "null"
                            }
                        ],
                        "valueName": "avg"
                    }
                ],
                "showTitle": true,
                "title": "Capacity Planning",
                "titleSize": "h6"
            }
        ],
        "schemaVersion": 14,
        "sharedCrosshair": false,
        "style": "dark",
        "tags": [],
        "templating": {
            "list": []
        },
        "time": {
            "from": "now-6h",
            "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": "browser",
        "title": "Kubernetes Cluster Status",
        "version": 3
    }
