apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboard-traefik
  namespace: monitoring
  labels:
    grafana_dashboard: "True"
data:
  traefik-dashboard.json: |+
    {
        "annotations": {
          "list": []
        },
        "description": "Visualize Traefik Health Metrics",
        "editable": true,
        "gnetId": 2240,
        "graphTooltip": 0,
        "hideControls": false,
        "id": null,
        "links": [],
        "refresh": "30s",
        "rows": [
          {
            "collapse": false,
            "height": 288,
            "panels": [
              {
                "cacheTimeout": null,
                "colorBackground": false,
                "colorValue": false,
                "colors": [
                  "rgba(245, 54, 54, 0.9)",
                  "rgba(237, 129, 40, 0.89)",
                  "rgba(50, 172, 45, 0.97)"
                ],
                "datasource": "$datasource",
                "decimals": 0,
                "format": "s",
                "gauge": {
                  "maxValue": 100,
                  "minValue": 0,
                  "show": false,
                  "thresholdLabels": false,
                  "thresholdMarkers": true
                },
                "id": 3,
                "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": 1,
                "sparkline": {
                  "fillColor": "rgba(31, 118, 189, 0.18)",
                  "full": false,
                  "lineColor": "rgb(31, 120, 193)",
                  "show": false
                },
                "tableColumn": "",
                "targets": [
                  {
                    "expr": "time() - avg(process_start_time_seconds{service=\"traefik-web-ui\"})",
                    "intervalFactor": 2,
                    "refId": "A",
                    "step": 1800
                  }
                ],
                "thresholds": "",
                "title": "Uptime",
                "type": "singlestat",
                "valueFontSize": "80%",
                "valueMaps": [
                  {
                    "op": "=",
                    "text": "N/A",
                    "value": "null"
                  }
                ],
                "valueName": "current"
              },
              {
                "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",
                "percentage": false,
                "pointradius": 5,
                "points": false,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "span": 3,
                "stack": false,
                "steppedLine": false,
                "targets": [
                  {
                    "expr": "sum(traefik_entrypoint_requests_total{entrypoint=\"http\"})",
                    "interval": "",
                    "intervalFactor": 2,
                    "legendFormat": "{{http}}",
                    "metric": "",
                    "refId": "A",
                    "step": 240
                  },
                  {
                    "expr": "sum(traefik_entrypoint_requests_total{entrypoint=\"https\"})",
                    "interval": "",
                    "intervalFactor": 2,
                    "legendFormat": "{{https}}",
                    "refId": "B",
                    "step": 240
                  }
                ],
                "thresholds": [],
                "timeFrom": null,
                "timeShift": null,
                "title": "Total requests",
                "tooltip": {
                  "shared": true,
                  "sort": 0,
                  "value_type": "individual"
                },
                "type": "graph",
                "xaxis": {
                  "buckets": null,
                  "mode": "time",
                  "name": null,
                  "show": true,
                  "values": []
                },
                "yaxes": [
                  {
                    "format": "none",
                    "label": "Count",
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": true
                  },
                  {
                    "format": "short",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": false
                  }
                ]
              },
              {
                "aliasColors": {},
                "bars": false,
                "dashLength": 10,
                "dashes": false,
                "datasource": "$datasource",
                "fill": 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",
                "percentage": false,
                "pointradius": 5,
                "points": false,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "span": 3,
                "stack": false,
                "steppedLine": false,
                "targets": [
                  {
                    "expr": "sum(traefik_entrypoint_request_duration_seconds_sum) / sum(traefik_entrypoint_requests_total) * 1000",
                    "intervalFactor": 2,
                    "legendFormat": "Average response time (ms)",
                    "refId": "A",
                    "step": 240
                  }
                ],
                "thresholds": [],
                "timeFrom": null,
                "timeShift": null,
                "title": "Average response time",
                "tooltip": {
                  "shared": true,
                  "sort": 0,
                  "value_type": "individual"
                },
                "type": "graph",
                "xaxis": {
                  "buckets": null,
                  "mode": "time",
                  "name": null,
                  "show": true,
                  "values": []
                },
                "yaxes": [
                  {
                    "format": "ms",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": true
                  },
                  {
                    "format": "short",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": true
                  }
                ]
              },
              {
                "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",
                "percentage": false,
                "pointradius": 5,
                "points": false,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "span": 5,
                "stack": false,
                "steppedLine": false,
                "targets": [
                  {
                    "expr": "sum(rate(traefik_entrypoint_requests_total[5m]))",
                    "interval": "",
                    "intervalFactor": 2,
                    "legendFormat": "{{requests}}",
                    "refId": "A",
                    "step": 240
                  }
                ],
                "thresholds": [],
                "timeFrom": null,
                "timeShift": null,
                "title": "Requests in last 5 minutes",
                "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": null,
                    "show": true
                  },
                  {
                    "format": "short",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": true
                  }
                ]
              }
            ],
            "repeat": null,
            "repeatIteration": null,
            "repeatRowId": null,
            "showTitle": false,
            "title": "General info",
            "titleSize": "h6"
          },
          {
            "collapse": false,
            "height": 412,
            "panels": [
              {
                "aliasColors": {},
                "bars": false,
                "dashLength": 10,
                "dashes": false,
                "datasource": "$datasource",
                "decimals": 0,
                "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",
                "percentage": false,
                "pointradius": 5,
                "points": false,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "span": 6,
                "stack": false,
                "steppedLine": false,
                "targets": [
                  {
                    "expr": "rate(traefik_entrypoint_requests_total{entrypoint=~\"http|https\",code=\"200\"}[5m])",
                    "intervalFactor": 2,
                    "legendFormat": "{{service}} {{method}} {{code}}",
                    "refId": "A",
                    "step": 240
                  }
                ],
                "thresholds": [],
                "timeFrom": null,
                "timeShift": null,
                "title": "Successful Status Code Count (5min)",
                "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": null,
                    "show": true
                  },
                  {
                    "format": "short",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": false
                  }
                ]
              },
              {
                "aliasColors": {},
                "bars": false,
                "dashLength": 10,
                "dashes": false,
                "datasource": "$datasource",
                "decimals": 0,
                "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",
                "percentage": false,
                "pointradius": 5,
                "points": false,
                "renderer": "flot",
                "seriesOverrides": [],
                "spaceLength": 10,
                "span": 6,
                "stack": false,
                "steppedLine": false,
                "targets": [
                  {
                    "expr": "rate(traefik_entrypoint_requests_total{entrypoint=~\"http|https\",code!=\"200\"}[5m])",
                    "intervalFactor": 2,
                    "legendFormat": "{{service}} {{method}} {{code}}",
                    "refId": "A",
                    "step": 240
                  }
                ],
                "thresholds": [],
                "timeFrom": null,
                "timeShift": null,
                "title": "Bad Status Code Count (5m)",
                "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": null,
                    "show": true
                  },
                  {
                    "format": "short",
                    "label": null,
                    "logBase": 1,
                    "max": null,
                    "min": null,
                    "show": false
                  }
                ]
              }
            ],
            "repeat": null,
            "repeatIteration": null,
            "repeatRowId": null,
            "showTitle": false,
            "title": "Dashboard Row",
            "titleSize": "h6"
          },
          {
            "collapse": false,
            "height": 382,
            "panels": [],
            "repeat": null,
            "repeatIteration": null,
            "repeatRowId": null,
            "showTitle": false,
            "title": "Detailed statuses",
            "titleSize": "h6"
          }
        ],
        "schemaVersion": 14,
        "style": "dark",
        "tags": [],
        "templating": {
          "list": [
                  {
                      "current": {
                          "text": "Prometheus",
                          "value": "Prometheus"
                      },
                      "hide": 0,
                      "label": null,
                      "name": "datasource",
                      "options": [

                      ],
                      "query": "prometheus",
                      "refresh": 1,
                      "regex": "",
                      "type": "datasource"
                  }
          ]
        },
        "time": {
          "from": "now/d",
          "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": "Traefik",
        "version": 1
      }