From 6354c103aef390ca9903d4fcacc6c52243bed35f Mon Sep 17 00:00:00 2001 From: Simon Emms Date: Wed, 11 Dec 2024 22:03:20 +0000 Subject: [PATCH] feat(metallb): add some monitoring --- .../components/metallb/kustomization.yaml | 2 + registry/components/metallb/monitor.yaml | 499 ++++++++++++++++++ registry/components/metallb/namespace.yaml | 2 + 3 files changed, 503 insertions(+) create mode 100644 registry/components/metallb/monitor.yaml diff --git a/registry/components/metallb/kustomization.yaml b/registry/components/metallb/kustomization.yaml index 9d33bce..0f515cd 100644 --- a/registry/components/metallb/kustomization.yaml +++ b/registry/components/metallb/kustomization.yaml @@ -4,3 +4,5 @@ resources: - application.yaml - l2-advertisement.yaml - generator.yaml + - monitor.yaml + - namespace.yaml diff --git a/registry/components/metallb/monitor.yaml b/registry/components/metallb/monitor.yaml new file mode 100644 index 0000000..8cabd63 --- /dev/null +++ b/registry/components/metallb/monitor.yaml @@ -0,0 +1,499 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: metallb + namespace: metallb-system + labels: + prometheus: enabled + annotations: + argocd.argoproj.io/sync-wave: "10" +spec: + selector: + matchLabels: + app.kubernetes.io/instance: metallb + app.kubernetes.io/name: metallb + podMetricsEndpoints: + - port: monitoring + path: /metrics +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: metallb + namespace: metallb-system + labels: + grafana_dashboard: "1" + annotations: + argocd.argoproj.io/sync-wave: "10" +data: + app.json: |- + { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Metallb key metrics", + "editable": false, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": 100, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "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": 7, + "w": 21, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "alertThreshold": true, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.3.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "metallb_allocator_addresses_total", + "instant": false, + "interval": "", + "legendFormat": "", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "metallb_allocator_addresses_in_use_total", + "interval": "", + "legendFormat": "", + "refId": "B" + } + ], + "title": "Address utilization", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 3, + "x": 21, + "y": 0 + }, + "id": 8, + "options": { + "minVizHeight": 75, + "minVizWidth": 75, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true, + "sizing": "auto" + }, + "pluginVersion": "11.3.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "sum(metallb_k8s_client_config_stale_bool)", + "format": "time_series", + "instant": true, + "interval": "", + "legendFormat": "client_config_stale", + "refId": "A" + } + ], + "title": "Stale config", + "type": "gauge" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "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": 9, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 6, + "options": { + "alertThreshold": true, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.3.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "rate(metallb_layer2_gratuitous_sent{instance=~\"$layer2instance\"}[5m])", + "hide": false, + "instant": false, + "interval": "", + "legendFormat": "gratuitous_sent instance={{instance}} ip={{ip}} ", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "rate(metallb_layer2_requests_received{instance=~\"$layer2instance\"}[5m])", + "hide": false, + "interval": "", + "legendFormat": "requests_received instance={{instance}} ip={{ip}} ", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "rate(metallb_layer2_responses_sent{instance=~\"$layer2instance\"}[5m])", + "hide": false, + "interval": "", + "legendFormat": "responses_sent instance={{instance}} ip={{ip}} ", + "refId": "C" + } + ], + "title": "Layer 2", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "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": 7, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 4, + "options": { + "alertThreshold": true, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.3.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "rate(metallb_k8s_client_update_errors_total[5m])", + "interval": "", + "legendFormat": "", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "rate(metallb_k8s_client_updates_total[5m])", + "interval": "", + "legendFormat": "", + "refId": "B" + } + ], + "title": "Client updates", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "", + "schemaVersion": 40, + "tags": [ + "metallb ", + "prometheus" + ], + "templating": { + "list": [ + { + "current": { + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": "prometheus", + "definition": "label_values(metallb_layer2_gratuitous_sent,instance)", + "includeAll": true, + "label": "Layer 2 instance", + "multi": true, + "name": "layer2instance", + "options": [], + "query": "label_values(metallb_layer2_gratuitous_sent,instance)", + "refresh": 2, + "regex": "", + "sort": 5, + "type": "query" + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Metallb", + "uid": "nvTWlxQGz", + "version": 1, + "weekStart": "" + } diff --git a/registry/components/metallb/namespace.yaml b/registry/components/metallb/namespace.yaml index 28cd7d6..4e8a07a 100644 --- a/registry/components/metallb/namespace.yaml +++ b/registry/components/metallb/namespace.yaml @@ -2,5 +2,7 @@ apiVersion: v1 kind: Namespace metadata: name: metallb-system + labels: + prometheus: enabled annotations: argocd.argoproj.io/sync-wave: "-1"