diff --git a/apps/grafana/resources/ceph-rbd-pvc-capacity-dashboard.yaml b/apps/grafana/resources/ceph-rbd-pvc-capacity-dashboard.yaml new file mode 100644 index 0000000..9813f61 --- /dev/null +++ b/apps/grafana/resources/ceph-rbd-pvc-capacity-dashboard.yaml @@ -0,0 +1,227 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: ceph-rbd-pvc-capacity-dashboard + namespace: default + labels: + grafana_dashboard: "1" +data: + ceph-rbd-pvc-capacity.json: |- + { + "annotations": {"list": []}, + "description": "Capacity, growth, and inode usage for mounted Ceph RBD Kubernetes PVCs.", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": { + "defaults": { + "color": {"mode": "thresholds"}, + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + {"color": "green", "value": null}, + {"color": "orange", "value": 75}, + {"color": "red", "value": 85} + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": {"h": 10, "w": 24, "x": 0, "y": 0}, + "id": 1, + "options": { + "displayMode": "gradient", + "minVizHeight": 10, + "minVizWidth": 0, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "12.3.1", + "targets": [ + { + "editorMode": "code", + "expr": "(100 * (1 - kubelet_volume_stats_available_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} / kubelet_volume_stats_capacity_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"})) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "instant": true, + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": false, + "refId": "A" + } + ], + "title": "Current RBD PVC usage", + "type": "bargauge" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": { + "defaults": { + "color": {"mode": "palette-classic"}, + "custom": {"drawStyle": "line", "fillOpacity": 8, "lineWidth": 2, "showPoints": "never"}, + "max": 100, + "min": 0, + "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "orange", "value": 75}, {"color": "red", "value": 85}]}, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": {"h": 9, "w": 16, "x": 0, "y": 10}, + "id": 2, + "options": {"legend": {"calcs": ["lastNotNull", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}}, + "targets": [ + { + "editorMode": "code", + "expr": "(100 * (1 - kubelet_volume_stats_available_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} / kubelet_volume_stats_capacity_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"})) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": true, + "refId": "A" + } + ], + "title": "RBD PVC usage history", + "type": "timeseries" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "thresholds"}, "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 1073741824}, {"color": "green", "value": 5368709120}]}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 9, "w": 8, "x": 16, "y": 10}, + "id": 3, + "options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showPercentChange": false, "textMode": "auto", "wideLayout": true}, + "targets": [ + { + "editorMode": "code", + "expr": "kubelet_volume_stats_available_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "instant": true, + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": false, + "refId": "A" + } + ], + "title": "Free space now", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "custom": {"drawStyle": "line", "fillOpacity": 8, "lineWidth": 2, "showPoints": "never"}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 9, "w": 12, "x": 0, "y": 19}, + "id": 4, + "options": {"legend": {"calcs": ["lastNotNull"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}}, + "targets": [ + { + "editorMode": "code", + "expr": "kubelet_volume_stats_used_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": true, + "refId": "A" + } + ], + "title": "Used bytes", + "type": "timeseries" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "custom": {"drawStyle": "line", "fillOpacity": 8, "lineWidth": 2, "showPoints": "never"}, "unit": "Bps"}, "overrides": []}, + "gridPos": {"h": 9, "w": 12, "x": 12, "y": 19}, + "id": 5, + "options": {"legend": {"calcs": ["lastNotNull"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}}, + "targets": [ + { + "editorMode": "code", + "expr": "clamp_min(deriv(kubelet_volume_stats_used_bytes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}[6h]), 0) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": true, + "refId": "A" + } + ], + "title": "Six-hour growth rate", + "type": "timeseries" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "custom": {"drawStyle": "line", "fillOpacity": 8, "lineWidth": 2, "showPoints": "never"}, "max": 100, "min": 0, "unit": "percent"}, "overrides": []}, + "gridPos": {"h": 8, "w": 24, "x": 0, "y": 28}, + "id": 6, + "options": {"legend": {"calcs": ["lastNotNull"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}}, + "targets": [ + { + "editorMode": "code", + "expr": "(100 * kubelet_volume_stats_inodes_used{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} / kubelet_volume_stats_inodes{job=\"kubelet\",metrics_path=\"/metrics\",namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}", + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": true, + "refId": "A" + } + ], + "title": "Inode usage", + "type": "timeseries" + } + ], + "refresh": "1m", + "schemaVersion": 42, + "tags": ["ceph", "rbd", "kubernetes", "storage"], + "templating": { + "list": [ + { + "current": {"selected": true, "text": "Prometheus", "value": "aevstx976yku8a"}, + "hide": 0, + "includeAll": false, + "label": "Prometheus", + "multi": false, + "name": "DS_PROMETHEUS", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "allValue": ".*", + "current": {"selected": true, "text": "All", "value": "$__all"}, + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "definition": "label_values(kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}, namespace)", + "includeAll": true, + "label": "Namespace", + "multi": true, + "name": "namespace", + "options": [], + "query": {"query": "label_values(kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\"}, namespace)", "refId": "PrometheusVariableQueryEditor-VariableQuery"}, + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "current": {"selected": true, "text": "All", "value": "$__all"}, + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "definition": "label_values(kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\",namespace=~\"$namespace\"}, persistentvolumeclaim)", + "includeAll": true, + "label": "PVC", + "multi": true, + "name": "pvc", + "options": [], + "query": {"query": "label_values(kube_persistentvolumeclaim_info{storageclass=~\"rook-ceph-block.*\",namespace=~\"$namespace\"}, persistentvolumeclaim)", "refId": "PrometheusVariableQueryEditor-VariableQuery"}, + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + } + ] + }, + "time": {"from": "now-7d", "to": "now"}, + "timepicker": {}, + "timezone": "browser", + "title": "Ceph RBD PVC Capacity", + "uid": "ceph-rbd-pvc-capacity", + "version": 1, + "weekStart": "" + } diff --git a/apps/grafana/resources/dahoam-disk-health-dashboard.yaml b/apps/grafana/resources/dahoam-disk-health-dashboard.yaml new file mode 100644 index 0000000..7480803 --- /dev/null +++ b/apps/grafana/resources/dahoam-disk-health-dashboard.yaml @@ -0,0 +1,170 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: dahoam-disk-health-dashboard + namespace: default + labels: + grafana_dashboard: "1" +data: + dahoam-disk-health.json: |- + { + "annotations": {"list": []}, + "description": "Sortable current SMART and bcachefs device inventory for dahoam (arschrock).", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "datasource": {"type": "influxdb", "uid": "${DS_INFLUXDB}"}, + "description": "Latest SMART values from Telegraf, joined to the existing bcachefs_devices measurement by physical drive. Click any heading to sort.", + "fieldConfig": { + "defaults": {}, + "overrides": [ + { + "matcher": {"id": "byName", "options": "Health"}, + "properties": [ + { + "id": "mappings", + "value": [ + { + "options": { + "false": {"color": "red", "index": 1, "text": "FAILED"}, + "true": {"color": "green", "index": 0, "text": "PASSED"} + }, + "type": "value" + } + ] + }, + {"id": "custom.cellOptions", "value": {"type": "color-text"}} + ] + }, + { + "matcher": {"id": "byName", "options": "Temperature"}, + "properties": [ + {"id": "unit", "value": "celsius"}, + {"id": "custom.cellOptions", "value": {"type": "color-text"}}, + {"id": "thresholds", "value": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "orange", "value": 45}, {"color": "red", "value": 55}]}} + ] + }, + { + "matcher": {"id": "byName", "options": "Lifetime remaining"}, + "properties": [ + {"id": "unit", "value": "percent"}, + {"id": "custom.cellOptions", "value": {"type": "color-text"}}, + {"id": "thresholds", "value": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 10}, {"color": "green", "value": 25}]}} + ] + }, + { + "matcher": {"id": "byName", "options": "Power-on hours"}, + "properties": [{"id": "unit", "value": "suffix: h"}] + }, + { + "matcher": {"id": "byRegexp", "options": "/^(Reallocated sectors|Reallocated events|Pending sectors|Offline uncorrectable|Reported uncorrectable)$/"}, + "properties": [ + {"id": "custom.cellOptions", "value": {"type": "color-text"}}, + {"id": "thresholds", "value": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "red", "value": 1}]}} + ] + } + ] + }, + "gridPos": {"h": 26, "w": 24, "x": 0, "y": 0}, + "id": 1, + "options": { + "cellHeight": "sm", + "footer": {"countRows": false, "fields": "", "reducer": ["sum"], "show": false}, + "showHeader": true, + "sortBy": [{"desc": false, "displayName": "Drive"}] + }, + "pluginVersion": "12.3.1", + "targets": [ + { + "datasource": {"type": "influxdb", "uid": "${DS_INFLUXDB}"}, + "query": "import \"strings\"\n\nfrom(bucket: \"telegraf\")\n |> range(start: -1h)\n |> filter(fn: (r) => r._measurement == \"smart_device\" and r.host == \"arschrock\")\n |> filter(fn: (r) => contains(value: r._field, set: [\"power_on_hours\", \"reallocated_sectors_count\", \"realloc_event_count\", \"pending_sector_count\", \"uncorrectable_sector_count\", \"percent_lifetime_remain\", \"uncorrectable_errors\", \"temp_c\"]))\n |> last()\n |> group(columns: [\"device\", \"model\"])\n |> pivot(rowKey: [\"device\", \"model\"], columnKey: [\"_field\"], valueColumn: \"_value\")\n |> group()\n |> map(fn: (r) => ({r with drive: if strings.hasPrefix(v: r.device, prefix: \"nvme\") then r.device + \"n1\" else r.device}))\n |> keep(columns: [\"drive\", \"model\", \"power_on_hours\", \"reallocated_sectors_count\", \"realloc_event_count\", \"pending_sector_count\", \"uncorrectable_sector_count\", \"percent_lifetime_remain\", \"uncorrectable_errors\", \"temp_c\"])\n |> sort(columns: [\"drive\"])", + "refId": "A" + }, + { + "datasource": {"type": "influxdb", "uid": "${DS_INFLUXDB}"}, + "query": "import \"strings\"\n\nfrom(bucket: \"telegraf\")\n |> range(start: -1h)\n |> filter(fn: (r) => r._measurement == \"smart_device\" and r.host == \"arschrock\" and r._field == \"health_ok\")\n |> group(columns: [\"device\"])\n |> last()\n |> group()\n |> map(fn: (r) => ({drive: if strings.hasPrefix(v: r.device, prefix: \"nvme\") then r.device + \"n1\" else r.device, health_ok: r._value}))\n |> sort(columns: [\"drive\"])", + "refId": "B" + }, + { + "datasource": {"type": "influxdb", "uid": "${DS_INFLUXDB}"}, + "query": "import \"regexp\"\n\nfrom(bucket: \"telegraf\")\n |> range(start: -1h)\n |> filter(fn: (r) => r._measurement == \"bcachefs_devices\" and r.host == \"arschrock\" and r._field == \"capacity_data\")\n |> last()\n |> group()\n |> map(fn: (r) => ({drive: regexp.replaceAllString(r: /p[0-9]+$/, v: r.device, t: \"\"), bcachefs_diskid: int(v: r.devid), bcachefs_label: r.label}))\n |> sort(columns: [\"drive\"])", + "refId": "C" + } + ], + "title": "Disk health and bcachefs membership", + "transformations": [ + {"id": "merge", "options": {}}, + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "drive": 0, + "model": 1, + "bcachefs_diskid": 2, + "bcachefs_label": 3, + "health_ok": 4, + "temp_c": 5, + "power_on_hours": 6, + "reallocated_sectors_count": 7, + "realloc_event_count": 8, + "pending_sector_count": 9, + "uncorrectable_sector_count": 10, + "percent_lifetime_remain": 11, + "uncorrectable_errors": 12 + }, + "renameByName": { + "bcachefs_diskid": "bcachefs disk ID", + "bcachefs_label": "bcachefs label", + "drive": "Drive", + "health_ok": "Health", + "model": "Model", + "pending_sector_count": "Pending sectors", + "percent_lifetime_remain": "Lifetime remaining", + "power_on_hours": "Power-on hours", + "realloc_event_count": "Reallocated events", + "reallocated_sectors_count": "Reallocated sectors", + "temp_c": "Temperature", + "uncorrectable_errors": "Reported uncorrectable", + "uncorrectable_sector_count": "Offline uncorrectable" + } + } + } + ], + "type": "table" + } + ], + "refresh": "1m", + "schemaVersion": 42, + "tags": ["dahoam", "smart", "bcachefs", "storage"], + "templating": { + "list": [ + { + "current": {"selected": true, "text": "influxdb", "value": "aes16l4bz9xc0a"}, + "hide": 0, + "includeAll": false, + "label": "InfluxDB", + "multi": false, + "name": "DS_INFLUXDB", + "options": [], + "query": "influxdb", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + } + ] + }, + "time": {"from": "now-6h", "to": "now"}, + "timepicker": {}, + "timezone": "browser", + "title": "dahoam Disk Health", + "uid": "dahoam-disk-health", + "version": 1, + "weekStart": "" + } diff --git a/apps/grafana/resources/kubernetes-pvc-overview-dashboard.yaml b/apps/grafana/resources/kubernetes-pvc-overview-dashboard.yaml new file mode 100644 index 0000000..23c9f87 --- /dev/null +++ b/apps/grafana/resources/kubernetes-pvc-overview-dashboard.yaml @@ -0,0 +1,248 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: kubernetes-pvc-overview-dashboard + namespace: default + labels: + grafana_dashboard: "1" +data: + kubernetes-pvc-overview.json: |- + { + "annotations": {"list": []}, + "description": "Cluster-wide PVC inventory and mounted filesystem usage, including namespace, PV, storage class, workload owner, and pod labels.", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 5, "w": 8, "x": 0, "y": 0}, + "id": 1, + "options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto", "wideLayout": true}, + "targets": [ + { + "editorMode": "code", + "expr": "sum(kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"})", + "instant": true, + "legendFormat": "Requested", + "range": false, + "refId": "A" + } + ], + "title": "Requested PVC capacity", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 5, "w": 8, "x": 8, "y": 0}, + "id": 2, + "options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto", "wideLayout": true}, + "targets": [ + { + "editorMode": "code", + "expr": "sum(max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) * on(namespace,persistentvolumeclaim) group_left(storageclass) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"})", + "instant": true, + "legendFormat": "Used", + "range": false, + "refId": "A" + } + ], + "title": "Mounted PVC space used", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 5, "w": 8, "x": 16, "y": 0}, + "id": 3, + "options": {"colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "textMode": "auto", "wideLayout": true}, + "targets": [ + { + "editorMode": "code", + "expr": "sum(max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_available_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) * on(namespace,persistentvolumeclaim) group_left(storageclass) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"})", + "instant": true, + "legendFormat": "Free", + "range": false, + "refId": "A" + } + ], + "title": "Mounted PVC space free", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": { + "defaults": { + "color": {"mode": "thresholds"}, + "max": 100, + "min": 0, + "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "orange", "value": 75}, {"color": "red", "value": 85}]}, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": {"h": 13, "w": 24, "x": 0, "y": 5}, + "id": 4, + "options": {"cellHeight": "sm", "footer": {"countRows": false, "fields": "", "reducer": ["sum"], "show": false}, "showHeader": true}, + "targets": [ + { + "editorMode": "code", + "expr": "(max by(namespace,persistentvolumeclaim,pod,volume) (kube_pod_spec_volumes_persistentvolumeclaims_info{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) ((100 * (1 - max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_available_bytes) / max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes))) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"})) * on(namespace,pod) group_left(owner_kind,owner_name,workload) max by(namespace,pod,owner_kind,owner_name,workload) (label_replace(kube_pod_owner{owner_kind=\"ReplicaSet\"}, \"workload\", \"$1\", \"owner_name\", \"(.+)-[a-z0-9]{8,10}\") or label_replace(kube_pod_owner{owner_kind!=\"ReplicaSet\"}, \"workload\", \"$1\", \"owner_name\", \"(.+)\"))", + "format": "table", + "instant": true, + "legendFormat": "__auto", + "range": false, + "refId": "A" + } + ], + "title": "PVC usage by namespace, workload, and pod", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {"Time": true, "owner_name": true, "volume": true}, + "indexByName": {"namespace": 0, "workload": 1, "owner_kind": 2, "pod": 3, "persistentvolumeclaim": 4, "volumename": 5, "storageclass": 6, "Value": 7}, + "renameByName": {"Value": "Used %", "namespace": "Namespace", "owner_kind": "Owner kind", "persistentvolumeclaim": "PVC", "pod": "Pod", "storageclass": "Storage class", "volumename": "PV", "workload": "Workload"} + } + } + ], + "type": "table" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 10, "w": 12, "x": 0, "y": 18}, + "id": 5, + "options": {"displayMode": "gradient", "minVizHeight": 12, "minVizWidth": 0, "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showUnfilled": true, "sizing": "auto", "valueMode": "color"}, + "targets": [ + { + "editorMode": "code", + "expr": "kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"} * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"}", + "instant": true, + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}} / {{storageclass}}", + "range": false, + "refId": "A" + } + ], + "title": "PVC requested capacity (includes PV name in labels)", + "type": "bargauge" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "thresholds"}, "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 1073741824}, {"color": "green", "value": 5368709120}]}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 10, "w": 12, "x": 12, "y": 18}, + "id": 6, + "options": {"displayMode": "gradient", "minVizHeight": 12, "minVizWidth": 0, "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showUnfilled": true, "sizing": "auto", "valueMode": "color"}, + "targets": [ + { + "editorMode": "code", + "expr": "max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_available_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"}", + "instant": true, + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": false, + "refId": "A" + } + ], + "title": "Mounted PVC free space", + "type": "bargauge" + }, + { + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "custom": {"drawStyle": "line", "fillOpacity": 8, "lineWidth": 2, "showPoints": "never"}, "max": 100, "min": 0, "unit": "percent"}, "overrides": []}, + "gridPos": {"h": 10, "w": 24, "x": 0, "y": 28}, + "id": 7, + "options": {"legend": {"calcs": ["lastNotNull", "max"], "displayMode": "table", "placement": "right", "showLegend": true}, "tooltip": {"mode": "multi", "sort": "desc"}}, + "targets": [ + { + "editorMode": "code", + "expr": "(100 * (1 - max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_available_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}) / max by(namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace=~\"$namespace\",persistentvolumeclaim=~\"$pvc\"}))) * on(namespace,persistentvolumeclaim) group_left(storageclass,volumename) kube_persistentvolumeclaim_info{storageclass=~\"$storageclass\"}", + "legendFormat": "{{namespace}} / {{persistentvolumeclaim}}", + "range": true, + "refId": "A" + } + ], + "title": "Mounted PVC usage history", + "type": "timeseries" + } + ], + "refresh": "1m", + "schemaVersion": 42, + "tags": ["kubernetes", "storage", "pv", "pvc", "capacity"], + "templating": { + "list": [ + { + "current": {"selected": true, "text": "Prometheus", "value": "aevstx976yku8a"}, + "hide": 0, + "includeAll": false, + "label": "Prometheus", + "multi": false, + "name": "DS_PROMETHEUS", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "allValue": ".*", + "current": {"selected": true, "text": "All", "value": "$__all"}, + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "definition": "label_values(kube_persistentvolumeclaim_info, namespace)", + "includeAll": true, + "label": "Namespace", + "multi": true, + "name": "namespace", + "options": [], + "query": {"query": "label_values(kube_persistentvolumeclaim_info, namespace)", "refId": "PrometheusVariableQueryEditor-VariableQuery"}, + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "current": {"selected": true, "text": "All", "value": "$__all"}, + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "definition": "label_values(kube_persistentvolumeclaim_info{namespace=~\"$namespace\"}, storageclass)", + "includeAll": true, + "label": "Storage class", + "multi": true, + "name": "storageclass", + "options": [], + "query": {"query": "label_values(kube_persistentvolumeclaim_info{namespace=~\"$namespace\"}, storageclass)", "refId": "PrometheusVariableQueryEditor-VariableQuery"}, + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "current": {"selected": true, "text": "All", "value": "$__all"}, + "datasource": {"type": "prometheus", "uid": "${DS_PROMETHEUS}"}, + "definition": "label_values(kube_persistentvolumeclaim_info{namespace=~\"$namespace\",storageclass=~\"$storageclass\"}, persistentvolumeclaim)", + "includeAll": true, + "label": "PVC", + "multi": true, + "name": "pvc", + "options": [], + "query": {"query": "label_values(kube_persistentvolumeclaim_info{namespace=~\"$namespace\",storageclass=~\"$storageclass\"}, persistentvolumeclaim)", "refId": "PrometheusVariableQueryEditor-VariableQuery"}, + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + } + ] + }, + "time": {"from": "now-7d", "to": "now"}, + "timepicker": {}, + "timezone": "browser", + "title": "Kubernetes PV / PVC Overview", + "uid": "kubernetes-pvc-overview", + "version": 1, + "weekStart": "" + } diff --git a/apps/grafana/resources/kustomization.yaml b/apps/grafana/resources/kustomization.yaml new file mode 100644 index 0000000..ac2bb70 --- /dev/null +++ b/apps/grafana/resources/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: default +resources: +- ceph-rbd-pvc-capacity-dashboard.yaml +- dahoam-disk-health-dashboard.yaml +- kubernetes-pvc-overview-dashboard.yaml +- mikrotik-storage-dashboard.yaml +configMapGenerator: +- name: traefik-official-dashboard + files: + - traefik-official.json + options: + disableNameSuffixHash: true + labels: + grafana_dashboard: "1" diff --git a/apps/grafana/resources/mikrotik-storage-dashboard.yaml b/apps/grafana/resources/mikrotik-storage-dashboard.yaml new file mode 100644 index 0000000..8bd7e96 --- /dev/null +++ b/apps/grafana/resources/mikrotik-storage-dashboard.yaml @@ -0,0 +1,124 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mikrotik-storage-dashboard + namespace: default + labels: + grafana_dashboard: "1" +data: + mikrotik-storage.json: |- + { + "annotations": {"list": []}, + "description": "RouterOS writable flash capacity exported by MKTXP.", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "fieldConfig": { + "defaults": { + "color": {"mode": "thresholds"}, + "mappings": [], + "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "green", "value": 1}]} + }, + "overrides": [] + }, + "gridPos": {"h": 5, "w": 6, "x": 0, "y": 0}, + "id": 1, + "options": {"colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showPercentChange": false, "textMode": "auto", "wideLayout": true}, + "pluginVersion": "12.3.1", + "targets": [{"editorMode": "code", "expr": "count(mktxp_system_free_hdd_space)", "instant": true, "legendFormat": "Devices", "range": false, "refId": "A"}], + "title": "Monitored devices", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "fieldConfig": { + "defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "orange", "value": 1}] }}, + "overrides": [] + }, + "gridPos": {"h": 5, "w": 6, "x": 6, "y": 0}, + "id": 2, + "options": {"colorMode": "background", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showPercentChange": false, "textMode": "auto", "wideLayout": true}, + "pluginVersion": "12.3.1", + "targets": [{"editorMode": "code", "expr": "count(mktxp_system_free_hdd_space < 131072)", "instant": true, "legendFormat": "Below 128 KiB", "range": false, "refId": "A"}], + "title": "Low space", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "fieldConfig": { + "defaults": {"color": {"mode": "thresholds"}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "green", "value": null}, {"color": "red", "value": 1}] }}, + "overrides": [] + }, + "gridPos": {"h": 5, "w": 6, "x": 12, "y": 0}, + "id": 3, + "options": {"colorMode": "background", "graphMode": "none", "justifyMode": "auto", "orientation": "auto", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showPercentChange": false, "textMode": "auto", "wideLayout": true}, + "pluginVersion": "12.3.1", + "targets": [{"editorMode": "code", "expr": "count(mktxp_system_free_hdd_space < 65536)", "instant": true, "legendFormat": "Below 64 KiB", "range": false, "refId": "A"}], + "title": "Critical space", + "type": "stat" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "fieldConfig": {"defaults": {"color": {"mode": "continuous-GrYlRd"}, "custom": {"fillOpacity": 70, "lineWidth": 1}, "mappings": [], "max": 131072, "min": 0, "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 65536}, {"color": "green", "value": 131072}]}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 5, "w": 6, "x": 18, "y": 0}, + "id": 4, + "options": {"displayMode": "gradient", "legend": {"displayMode": "list", "placement": "bottom", "showLegend": false}, "maxVizHeight": 300, "minVizHeight": 10, "minVizWidth": 0, "namePlacement": "auto", "orientation": "horizontal", "reduceOptions": {"calcs": ["lastNotNull"], "fields": "", "values": false}, "showUnfilled": true, "sizing": "auto", "valueMode": "color"}, + "pluginVersion": "12.3.1", + "targets": [{"editorMode": "code", "expr": "min(mktxp_system_free_hdd_space)", "instant": true, "legendFormat": "Lowest free space", "range": false, "refId": "A"}], + "title": "Lowest free space", + "type": "bargauge" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "description": "Current MKTXP inventory. Sort by Free flash to find constrained RouterBOARDs.", + "fieldConfig": { + "defaults": {}, + "overrides": [ + {"matcher": {"id": "byName", "options": "Free flash"}, "properties": [{"id": "unit", "value": "bytes"}, {"id": "custom.cellOptions", "value": {"type": "color-text"}}, {"id": "thresholds", "value": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 65536}, {"color": "green", "value": 131072}]}}]}, + {"matcher": {"id": "byName", "options": "Total flash"}, "properties": [{"id": "unit", "value": "bytes"}]} + ] + }, + "gridPos": {"h": 17, "w": 24, "x": 0, "y": 5}, + "id": 5, + "options": {"cellHeight": "sm", "footer": {"countRows": false, "fields": "", "reducer": ["sum"], "show": false}, "showHeader": true, "sortBy": [{"desc": false, "displayName": "Free flash"}]}, + "pluginVersion": "12.3.1", + "targets": [ + {"editorMode": "code", "expr": "mktxp_system_free_hdd_space", "format": "time_series", "instant": true, "legendFormat": "Free flash", "range": false, "refId": "A"}, + {"editorMode": "code", "expr": "mktxp_system_total_hdd_space", "format": "time_series", "instant": true, "legendFormat": "Total flash", "range": false, "refId": "B"} + ], + "title": "RouterOS flash inventory", + "transformations": [ + {"id": "labelsToFields", "options": {"mode": "columns"}}, + {"id": "organize", "options": {"excludeByName": {"Time": true, "architecture_name": true, "cpu": true, "job": true, "routerboard_address": true}, "indexByName": {"routerboard_name": 0, "board_name": 1, "version": 2, "Free flash": 3, "Total flash": 4}, "renameByName": {"board_name": "Board", "routerboard_name": "Device", "version": "RouterOS"}}} + ], + "type": "table" + }, + { + "datasource": {"type": "prometheus", "uid": "aevstx976yku8a"}, + "fieldConfig": {"defaults": {"color": {"mode": "palette-classic"}, "custom": {"axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 5, "gradientMode": "none", "hideFrom": {"legend": false, "tooltip": false, "viz": false}, "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 3, "scaleDistribution": {"type": "linear"}, "showPoints": "never", "spanNulls": false, "stacking": {"group": "A", "mode": "none"}}, "mappings": [], "thresholds": {"mode": "absolute", "steps": [{"color": "red", "value": null}, {"color": "orange", "value": 65536}, {"color": "green", "value": 131072}]}, "unit": "bytes"}, "overrides": []}, + "gridPos": {"h": 12, "w": 24, "x": 0, "y": 22}, + "id": 6, + "options": {"legend": {"calcs": ["lastNotNull", "min"], "displayMode": "table", "placement": "right", "showLegend": true, "sortBy": "Last *", "sortDesc": false, "width": 350}, "tooltip": {"hideZeros": false, "mode": "multi", "sort": "asc"}}, + "pluginVersion": "12.3.1", + "targets": [{"editorMode": "code", "expr": "mktxp_system_free_hdd_space", "legendFormat": "{{routerboard_name}}", "range": true, "refId": "A"}], + "title": "Free flash history", + "type": "timeseries" + } + ], + "refresh": "30s", + "schemaVersion": 42, + "tags": ["mikrotik", "routeros", "mktxp", "storage"], + "templating": {"list": []}, + "time": {"from": "now-24h", "to": "now"}, + "timepicker": {}, + "timezone": "browser", + "title": "MikroTik Storage", + "uid": "mikrotik-storage", + "version": 1, + "weekStart": "" + } diff --git a/apps/grafana/resources/traefik-official.json b/apps/grafana/resources/traefik-official.json new file mode 100644 index 0000000..1cde34c --- /dev/null +++ b/apps/grafana/resources/traefik-official.json @@ -0,0 +1,1577 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "9.3.1" + }, + { + "type": "panel", + "id": "piechart", + "name": "Pie chart", + "version": "" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "Official dashboard for Traefik on Kubernetes", + "editable": false, + "fiscalYearStartMonth": 0, + "gnetId": 17347, + "graphTooltip": 0, + "id": null, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 9, + "panels": [], + "title": "General", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 5, + "x": 0, + "y": 1 + }, + "id": 13, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.3.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "count(traefik_config_reloads_total)", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Traefik Instances", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 7, + "x": 5, + "y": 1 + }, + "id": 7, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(rate(traefik_entrypoint_requests_total{entrypoint=~\"$entrypoint\"}[$interval])) by (entrypoint)", + "legendFormat": "{{entrypoint}}", + "range": true, + "refId": "A" + } + ], + "title": "Requests per Entrypoint", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "https://medium.com/@tristan_96324/prometheus-apdex-alerting-d17a065e39d0", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "(sum(rate(traefik_entrypoint_request_duration_seconds_bucket{le=\"0.3\",code=\"200\",entrypoint=~\"$entrypoint\"}[$interval])) by (method) + \n sum(rate(traefik_entrypoint_request_duration_seconds_bucket{le=\"1.2\",code=\"200\",entrypoint=~\"$entrypoint\"}[$interval])) by (method)) / 2 / \n sum(rate(traefik_entrypoint_request_duration_seconds_count{code=\"200\",entrypoint=~\"$entrypoint\"}[$interval])) by (method)\n", + "legendFormat": "{{method}}", + "range": true, + "refId": "A" + } + ], + "title": "Apdex score", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "Mean Distribution", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 5, + "x": 0, + "y": 3 + }, + "id": 14, + "options": { + "legend": { + "displayMode": "list", + "placement": "right", + "showLegend": true, + "values": [ + "percent" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "tooltip": { + "mode": "multi", + "sort": "asc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(rate(traefik_service_requests_total{service=~\"$service.*\",protocol=\"http\"}[$interval])) by (method, code)", + "legendFormat": "{{method}}[{{code}}]", + "range": true, + "refId": "A" + } + ], + "title": "Http Code ", + "type": "piechart" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 23, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n traefik_service_request_duration_seconds_sum{service=~\"$service.*\",protocol=\"http\"} / \n traefik_service_request_duration_seconds_count{service=~\"$service.*\",protocol=\"http\"},\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)\n\n", + "legendFormat": "{{method}}[{{code}}] on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Top slow services", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,code) \n (rate(traefik_service_requests_total{service=~\"$service.*\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "[{{code}}] on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Most requested services", + "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 17 + }, + "id": 11, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "label_replace(\n 1 - (sum by (service)\n (rate(traefik_service_request_duration_seconds_bucket{le=\"1.2\",service=~\"$service.*\"}[$interval])) / sum by (service) \n (rate(traefik_service_request_duration_seconds_count{service=~\"$service.*\"}[$interval]))\n ) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\"\n)", + "legendFormat": "{{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Services failing SLO of 1200ms", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "label_replace(\n 1 - (sum by (service)\n (rate(traefik_service_request_duration_seconds_bucket{le=\"0.3\",service=~\"$service.*\"}[$interval])) / sum by (service) \n (rate(traefik_service_request_duration_seconds_count{service=~\"$service.*\"}[$interval]))\n ) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\"\n)", + "legendFormat": "{{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Services failing SLO of 300ms", + "type": "timeseries" + } + ], + "title": "SLO", + "type": "row" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 16, + "panels": [], + "title": "HTTP Details", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 8, + "x": 0, + "y": 19 + }, + "id": 17, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,method,code) \n (rate(traefik_service_requests_total{service=~\"$service.*\",code=~\"2..\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "{{method}}[{{code}}] on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "2xx over $interval", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 8, + "x": 8, + "y": 19 + }, + "id": 18, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,method,code) \n (rate(traefik_service_requests_total{service=~\"$service.*\",code=~\"5..\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "{{method}}[{{code}}] on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "5xx over $interval", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 8, + "x": 16, + "y": 19 + }, + "id": 19, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,method,code) \n (rate(traefik_service_requests_total{service=~\"$service.*\",code!~\"2..|5..\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "{{method}}[{{code}}] on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Other codes over $interval", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 20, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,method) \n (rate(traefik_service_requests_bytes_total{service=~\"$service.*\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "{{method}} on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Requests Size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "binBps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 31 + }, + "id": 24, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Mean", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "topk(15,\n label_replace(\n sum by (service,method) \n (rate(traefik_service_responses_bytes_total{service=~\"$service.*\",protocol=\"http\"}[$interval])) > 0,\n \"service\", \"$1\", \"service\", \"([^@]+)@.*\")\n)", + "legendFormat": "{{method}} on {{service}}", + "range": true, + "refId": "A" + } + ], + "title": "Responses Size", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 39 + }, + "id": 21, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Max", + "sortDesc": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(traefik_open_connections{entrypoint=~\"$entrypoint\"}) by (entrypoint)\n", + "legendFormat": "{{entrypoint}}", + "range": true, + "refId": "A" + } + ], + "title": "Connections per Entrypoint", + "type": "timeseries" + } + ], + "refresh": false, + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "Prometheus", + "value": "Prometheus" + }, + "hide": 0, + "includeAll": false, + "multi": false, + "name": "DS_PROMETHEUS", + "label": "datasource", + "options": [], + "query": "prometheus", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "type": "datasource" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(traefik_open_connections, entrypoint)", + "hide": 0, + "includeAll": true, + "multi": false, + "name": "entrypoint", + "options": [], + "query": { + "query": "label_values(traefik_open_connections, entrypoint)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "auto": true, + "auto_count": 30, + "auto_min": "1m", + "current": { + "selected": false, + "text": "auto", + "value": "$__auto_interval_interval" + }, + "hide": 0, + "name": "interval", + "options": [ + { + "selected": true, + "text": "auto", + "value": "$__auto_interval_interval" + }, + { + "selected": false, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "5m", + "value": "5m" + }, + { + "selected": false, + "text": "10m", + "value": "10m" + }, + { + "selected": false, + "text": "30m", + "value": "30m" + }, + { + "selected": false, + "text": "1h", + "value": "1h" + }, + { + "selected": false, + "text": "2h", + "value": "2h" + }, + { + "selected": false, + "text": "4h", + "value": "4h" + }, + { + "selected": false, + "text": "8h", + "value": "8h" + } + ], + "query": "1m,5m,10m,30m,1h,2h,4h,8h", + "refresh": 2, + "skipUrlSync": false, + "type": "interval" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "definition": "label_values(traefik_service_requests_total, service)", + "hide": 0, + "includeAll": true, + "multi": false, + "name": "service", + "options": [], + "query": { + "query": "label_values(traefik_service_requests_total, service)", + "refId": "StandardVariableQuery" + }, + "refresh": 2, + "regex": "/([^@]+)@.*/", + "skipUrlSync": false, + "sort": 1, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Traefik Official Kubernetes Dashboard", + "uid": "n5bu_kv4k", + "version": 7, + "weekStart": "" +} diff --git a/apps/grafana/values.yaml b/apps/grafana/values.yaml new file mode 100644 index 0000000..6700de9 --- /dev/null +++ b/apps/grafana/values.yaml @@ -0,0 +1,84 @@ +admin: + existingSecret: grafana + +testFramework: + enabled: false + +ingress: + enabled: true + hosts: + - grafana.brunner.ninja + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + +envFromSecret: grafana-postgres-secret + +datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Prometheus + uid: aevstx976yku8a + type: prometheus + access: proxy + url: http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local:9090 + isDefault: false + editable: false + - name: Loki + uid: eevt1560lw3r4e + type: loki + access: proxy + url: http://loki.logging.svc.cluster.local:3100 + isDefault: false + editable: false + jsonData: + maxLines: 5000 + +sidecar: + dashboards: + enabled: true + skipReload: true + label: grafana_dashboard + labelValue: "1" + searchNamespace: default + provider: + allowUiUpdates: true + +grafana.ini: + server: + domain: grafana.brunner.ninja + root_url: https://%(domain)s/ + smtp: + enabled: true + host: smtp-relay.gmail.com:587 + skip_verify: false + from_address: alerts@brunner.ninja + from_name: Cluster Alerts + ehlo_identity: grafana.brunner.ninja + startTLS_policy: MandatoryStartTLS + database: + type: postgres + host: postgresql.default.svc.cluster.local + name: grafana + user: grafana + auth: + disable_login_form: true + signout_redirect_url: https://auth.brunner.ninja/application/o/grafana/end-session/ + oauth_auto_login: true + auth.anonymous: + enabled: true + org_name: Main Org. + org_role: Viewer + hide_version: true + auth.generic_oauth: + name: brunner.ninja auth + enabled: true + client_id: 4UivQGE1FvTVrlQ6azzc7DroYDDoprRLNKCTpIgc + scopes: openid email profile + role_attribute_path: contains(groups, 'Grafana Admins') && 'Admin' || contains(groups, 'Grafana Editors') && 'Editor' || 'Viewer' + auth_url: https://auth.brunner.ninja/application/o/authorize/ + token_url: https://auth.brunner.ninja/application/o/token/ + api_url: https://auth.brunner.ninja/application/o/userinfo/ + security: + allow_embedding: true + x_frame_options: "" diff --git a/bootstrap/grafana-project.yaml b/bootstrap/grafana-project.yaml new file mode 100644 index 0000000..641ea7e --- /dev/null +++ b/bootstrap/grafana-project.yaml @@ -0,0 +1,29 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: grafana + namespace: argocd +spec: + description: Grafana and its cluster-specific dashboards + sourceRepos: + - https://grafana-community.github.io/helm-charts + - https://code.brunner.ninja/feedc0de/homelab-gitops.git + destinations: + - namespace: default + server: https://kubernetes.default.svc + clusterResourceWhitelist: + - group: rbac.authorization.k8s.io + kind: ClusterRole + - group: rbac.authorization.k8s.io + kind: ClusterRoleBinding + namespaceResourceWhitelist: + - group: "" + kind: ConfigMap + - group: "" + kind: Service + - group: "" + kind: ServiceAccount + - group: apps + kind: Deployment + - group: networking.k8s.io + kind: Ingress diff --git a/bootstrap/grafana.yaml b/bootstrap/grafana.yaml new file mode 100644 index 0000000..79e664a --- /dev/null +++ b/bootstrap/grafana.yaml @@ -0,0 +1,29 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: grafana + namespace: argocd +spec: + project: grafana + sources: + - repoURL: https://grafana-community.github.io/helm-charts + chart: grafana + targetRevision: 14.0.1 + helm: + releaseName: grafana + valueFiles: + - $values/apps/grafana/values.yaml + - repoURL: https://code.brunner.ninja/feedc0de/homelab-gitops.git + targetRevision: main + ref: values + - repoURL: https://code.brunner.ninja/feedc0de/homelab-gitops.git + targetRevision: main + path: apps/grafana/resources + destination: + server: https://kubernetes.default.svc + namespace: default + syncPolicy: + automated: + enabled: true + prune: false + selfHeal: false diff --git a/bootstrap/kustomization.yaml b/bootstrap/kustomization.yaml index 89c34ae..f477d61 100644 --- a/bootstrap/kustomization.yaml +++ b/bootstrap/kustomization.yaml @@ -4,6 +4,7 @@ resources: - argocd-project.yaml - argocd.yaml - project.yaml +- grafana-project.yaml - platform-project.yaml - sealed-secrets.yaml - immich-sync.yaml @@ -52,5 +53,6 @@ resources: - ombi.yaml - tautulli.yaml - uptime-kuma.yaml +- grafana.yaml - visual-studio-code.yaml - wiki-js.yaml