---
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboards-caasp-certs
  namespace: monitoring
  labels:
    grafana_dashboard: "1"
data:
  caasp-certs.json: |-
    {
      "__inputs": [
        {
          "name": "DS_PROMETHEUS",
          "label": "Prometheus",
          "description": "",
          "type": "datasource",
          "pluginId": "prometheus",
          "pluginName": "Prometheus"
        }
      ],
      "__requires": [
        {
          "type": "grafana",
          "id": "grafana",
          "name": "Grafana",
          "version": "5.2.2"
        },
        {
          "type": "panel",
          "id": "graph",
          "name": "Graph",
          "version": "5.0.0"
        },
        {
          "type": "datasource",
          "id": "prometheus",
          "name": "Prometheus",
          "version": "5.0.0"
        },
        {
          "type": "panel",
          "id": "singlestat",
          "name": "Singlestat",
          "version": "5.0.0"
        },
        {
          "type": "panel",
          "id": "table",
          "name": "Table",
          "version": "5.0.0"
        }
      ],
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "id": null,
      "links": [],
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorPostfix": false,
          "colorPrefix": false,
          "colorValue": false,
          "colors": [
            "#E02F44",
            "#E02F44",
            "#E02F44"
          ],
          "format": "none",
          "gridPos": {
            "h": 2,
            "w": 8,
            "x": 0,
            "y": 0
          },
          "id": 11,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "count(cert_exporter_cert_expires_in_seconds <= 2592000)+count(cert_exporter_kubeconfig_expires_in_seconds <= 2592000)+count(cert_exporter_secret_expires_in_seconds <= 2592000) OR on() vector(0)",
              "format": "time_series",
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": null,
          "timeShift": null,
          "title": "Expiration within 1 month",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [],
          "valueName": "current",
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorPostfix": false,
          "colorPrefix": false,
          "colorValue": false,
          "colors": [
            "#FF780A",
            "#FF780A",
            "#FF780A"
          ],
          "format": "none",
          "gridPos": {
            "h": 2,
            "w": 8,
            "x": 8,
            "y": 0
          },
          "id": 8,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "count(2592000 < cert_exporter_cert_expires_in_seconds and cert_exporter_cert_expires_in_seconds <= 7776000)+count(2592000 < cert_exporter_kubeconfig_expires_in_seconds and cert_exporter_kubeconfig_expires_in_seconds <= 7776000)+count(2592000 < cert_exporter_secret_expires_in_seconds and cert_exporter_secret_expires_in_seconds <= 7776000) OR on() vector(0)",
              "format": "time_series",
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": null,
          "timeShift": null,
          "title": "Expiration within 1 and 3 months",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [],
          "valueName": "current",
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        },
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorPostfix": false,
          "colorPrefix": false,
          "colorValue": false,
          "colors": [
            "#56A64B",
            "#56A64B",
            "#56A64B"
          ],
          "format": "none",
          "gridPos": {
            "h": 2,
            "w": 8,
            "x": 16,
            "y": 0
          },
          "id": 6,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "count(cert_exporter_cert_expires_in_seconds > 7776000)+count(cert_exporter_kubeconfig_expires_in_seconds > 7776000)+count(cert_exporter_secret_expires_in_seconds > 7776000) OR on() vector(0)",
              "format": "time_series",
              "intervalFactor": 1,
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": null,
          "timeShift": null,
          "title": "Expiration after 3 months",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [],
          "valueName": "current",
          "gauge": {
            "show": false,
            "minValue": 0,
            "maxValue": 100,
            "thresholdMarkers": true,
            "thresholdLabels": false
          }
        },
        {
          "columns": [],
          "fontSize": "100%",
          "gridPos": {
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 6
          },
          "id": 2,
          "interval": "",
          "links": [],
          "options": {},
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 10,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "link": false,
              "pattern": "/(__name__|^name$|Time|controller_revision_hash|instance|job|kubernetes_namespace|kubernetes_pod_name|pod_template_generation|pod_template_hash|app|heritage)/",
              "type": "hidden"
            },
            {
              "alias": "Expiration",
              "colorMode": "cell",
              "colors": [
                "#E02F44",
                "#FF780A",
                "#56A64B"
              ],
              "dateFormat": "YYYY-MM-DD",
              "decimals": 2,
              "pattern": "Value",
              "thresholds": [
                "2592000",
                "7776000"
              ],
              "type": "number",
              "unit": "dtdurations"
            }
          ],
          "targets": [
            {
              "expr": "cert_exporter_cert_expires_in_seconds",
              "format": "table",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Kubernetes and ETCD PKI Certs Expiry",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "fontSize": "100%",
          "gridPos": {
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 14
          },
          "id": 3,
          "interval": "",
          "links": [],
          "options": {},
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 12,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "link": false,
              "pattern": "/(__name__|^name$|Time|controller_revision_hash|instance|job|kubernetes_namespace|kubernetes_pod_name|pod_template_generation|pod_template_hash|app|heritage)/",
              "type": "hidden"
            },
            {
              "alias": "Expiration",
              "colorMode": "cell",
              "colors": [
                "#E02F44",
                "#FF780A",
                "#56A64B"
              ],
              "dateFormat": "YYYY-MM-DD",
              "decimals": 2,
              "pattern": "Value",
              "thresholds": [
                "2592000",
                "7776000"
              ],
              "type": "number",
              "unit": "dtdurations"
            }
          ],
          "targets": [
            {
              "expr": "cert_exporter_kubeconfig_expires_in_seconds",
              "format": "table",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Kubeconfig Certs Expiry",
          "transform": "table",
          "type": "table"
        },
        {
          "columns": [],
          "fontSize": "100%",
          "gridPos": {
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 14
          },
          "id": 4,
          "interval": "",
          "links": [],
          "options": {},
          "pageSize": null,
          "scroll": true,
          "showHeader": true,
          "sort": {
            "col": 12,
            "desc": false
          },
          "styles": [
            {
              "alias": "Time",
              "dateFormat": "YYYY-MM-DD HH:mm:ss",
              "link": false,
              "pattern": "/(__name__|^name$|Time|controller_revision_hash|instance|job|kubernetes_namespace|kubernetes_pod_name|pod_template_generation|pod_template_hash|app|heritage)/",
              "type": "hidden"
            },
            {
              "alias": "Expiration",
              "colorMode": "cell",
              "colors": [
                "#E02F44",
                "#FF780A",
                "#56A64B"
              ],
              "dateFormat": "YYYY-MM-DD",
              "decimals": 2,
              "pattern": "Value",
              "thresholds": [
                "2592000",
                "7776000"
              ],
              "type": "number",
              "unit": "dtdurations"
            }
          ],
          "targets": [
            {
              "expr": "cert_exporter_secret_expires_in_seconds",
              "format": "table",
              "instant": true,
              "intervalFactor": 1,
              "legendFormat": "",
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Secret PKI Certs Expiry",
          "transform": "table",
          "type": "table"
        }
      ],
      "schemaVersion": 18,
      "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": "",
      "title": "SUSE CaaS Platform Certificates",
      "uid": "as4qRIIWz",
      "version": 4
    }
