From dcae5b6c3e27fbb376bb876421734a07cc78a2c6 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 18 Dec 2021 12:58:24 +0000 Subject: [PATCH] [hg612-exporter] Add Grafana Dashboards --- charts/hg612-exporter/Chart.yaml | 4 +- charts/hg612-exporter/README.md | 18 +- .../hg612-exporter/README_CHANGELOG.md.gotmpl | 14 + charts/hg612-exporter/ci/test-values.yaml | 4 + charts/hg612-exporter/dashboards/hg612.json | 496 ++++++++++++++++++ .../templates/dashboard-configmap.yaml | 19 + charts/hg612-exporter/values.yaml | 9 + 7 files changed, 561 insertions(+), 3 deletions(-) create mode 100644 charts/hg612-exporter/dashboards/hg612.json create mode 100644 charts/hg612-exporter/templates/dashboard-configmap.yaml diff --git a/charts/hg612-exporter/Chart.yaml b/charts/hg612-exporter/Chart.yaml index ebceb7f..823e732 100644 --- a/charts/hg612-exporter/Chart.yaml +++ b/charts/hg612-exporter/Chart.yaml @@ -2,13 +2,13 @@ apiVersion: v2 appVersion: 0.0.1 description: A prometheus exporter for the HG612 modem name: hg612-exporter -version: 0.0.3 +version: 1.1.0 kubeVersion: ">=1.16.0-0" keywords: - hg612-exporter home: https://github.com/nikdoof/helm-charts/tree/master/charts/hg612-exporter sources: -- https://github.com/nikdoof/hg612-exporter-docker +- https://github.com/nikdoof/hg612-exporter maintainers: - name: nikdoof email: andy@tensixtyone.com diff --git a/charts/hg612-exporter/README.md b/charts/hg612-exporter/README.md index 6fc8b84..fef9e04 100644 --- a/charts/hg612-exporter/README.md +++ b/charts/hg612-exporter/README.md @@ -1,6 +1,6 @@ # hg612-exporter -![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) +![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) A prometheus exporter for the HG612 modem @@ -80,6 +80,8 @@ N/A | image.repository | string | `"nikdoof/hg612-exporter"` | image repository | | image.tag | string | `"0.0.1"` | image tag | | ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. | +| metrics.dashboards | object | See values.yaml | Enable and configure Grafana dashboard ConfigMaps for the chart under this key. | +| metrics.dashboards.namespace | string | `nil` | Namespace to create the dashboards ConfigMap under. | | metrics.enabled | bool | See values.yaml | Enable and configure a Prometheus serviceMonitor for the chart under this key. | | metrics.prometheusRule | object | See values.yaml | Enable and configure Prometheus Rules for the chart under this key. | | metrics.prometheusRule.rules | list | See prometheusrules.yaml | Configure additionial rules for the chart under this key. | @@ -98,6 +100,20 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [1.1.0] + +#### Added + +- Grafana dashboard ConfigMap + +#### Changed + +- N/A + +#### Removed + +- N/A + ### [1.0.0] #### Added diff --git a/charts/hg612-exporter/README_CHANGELOG.md.gotmpl b/charts/hg612-exporter/README_CHANGELOG.md.gotmpl index 06ad5fb..37998b6 100644 --- a/charts/hg612-exporter/README_CHANGELOG.md.gotmpl +++ b/charts/hg612-exporter/README_CHANGELOG.md.gotmpl @@ -9,6 +9,20 @@ All notable changes to this application Helm chart will be documented in this fi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [1.1.0] + +#### Added + +- Grafana dashboard ConfigMap + +#### Changed + +- N/A + +#### Removed + +- N/A + ### [1.0.0] #### Added diff --git a/charts/hg612-exporter/ci/test-values.yaml b/charts/hg612-exporter/ci/test-values.yaml index 9a60d36..3328508 100644 --- a/charts/hg612-exporter/ci/test-values.yaml +++ b/charts/hg612-exporter/ci/test-values.yaml @@ -2,3 +2,7 @@ modem: host: test identifier: test +metrics: + enabled: true + dashboards: + create: true diff --git a/charts/hg612-exporter/dashboards/hg612.json b/charts/hg612-exporter/dashboards/hg612.json new file mode 100644 index 0000000..5bada63 --- /dev/null +++ b/charts/hg612-exporter/dashboards/hg612.json @@ -0,0 +1,496 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 34, + "iteration": 1639831202787, + "links": [], + "liveNow": false, + "panels": [ + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "index": 0, + "text": "Down" + }, + "1": { + "index": 1, + "text": "Up" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 1 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 2, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.3.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_status{host=\"$host\"}", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "title": "DSL Status", + "type": "stat" + }, + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-BlYlRd" + }, + "decimals": 3, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "Kbits" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 4, + "x": 2, + "y": 0 + }, + "id": 4, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.3.2", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_down_current_rate", + "interval": "", + "legendFormat": "Downstream", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_up_current_rate", + "hide": false, + "interval": "", + "legendFormat": "Upstream", + "refId": "C" + } + ], + "title": "Current Sync Speed", + "type": "stat" + }, + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-BlYlRd" + }, + "custom": { + "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": "Kbits" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "Max.*" + }, + "properties": [ + { + "id": "custom.fillOpacity", + "value": 10 + }, + { + "id": "custom.lineWidth", + "value": 0 + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 11, + "x": 0, + "y": 6 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_down_current_rate{host=\"$host\"}", + "interval": "", + "legendFormat": "Down", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_down_max_rate{host=\"$host\"}", + "hide": false, + "interval": "", + "legendFormat": "Max Attainable", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_up_current_rate{host=\"$host\"} * -1", + "hide": false, + "interval": "", + "legendFormat": "Up", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "dsl_up_max_rate{host=\"$host\"} * -1", + "hide": false, + "interval": "", + "legendFormat": "Max Attainable", + "refId": "D" + } + ], + "title": "Sync Speed", + "type": "timeseries" + }, + { + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "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": 9, + "w": 11, + "x": 0, + "y": 16 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_down_crc{host=\"$host\"}[$__rate_interval]) * -1", + "interval": "", + "legendFormat": "CRC Down", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_up_crc{host=\"$host\"}[$__rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "CRC Up", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_down_fec{host=\"$host\"}[$__rate_interval]) * -1", + "hide": false, + "interval": "", + "legendFormat": "FEC Down", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_up_fec{host=\"$host\"}[$__rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "FEC Up", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_down_hec{host=\"$host\"}[$__rate_interval]) * -1", + "hide": false, + "interval": "", + "legendFormat": "HEC Down", + "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "exemplar": true, + "expr": "increase(dsl_up_hec{host=\"$host\"}[$__rate_interval])", + "hide": false, + "interval": "", + "legendFormat": "HEC Up", + "refId": "F" + } + ], + "title": "DSL Errors", + "type": "timeseries" + } + ], + "schemaVersion": 33, + "style": "dark", + "tags": [ + "hg612", + "hg612-exporter" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "10.101.3.4", + "value": "10.101.3.4" + }, + "definition": "label_values(dsl_status, host)", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "host", + "options": [], + "query": { + "query": "label_values(dsl_status, host)", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "HG612", + "uid": "42KBhvTnz", + "version": 8, + "weekStart": "" +} diff --git a/charts/hg612-exporter/templates/dashboard-configmap.yaml b/charts/hg612-exporter/templates/dashboard-configmap.yaml new file mode 100644 index 0000000..4381013 --- /dev/null +++ b/charts/hg612-exporter/templates/dashboard-configmap.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.metrics.enabled .Values.metrics.dashboards.create }} +{{- $namespace := .Values.metrics.dashboards.namespace | default $.Release.Namespace }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ $namespace }} + labels: + {{- include "common.labels" . | nindent 4 }} + {{- with .Values.metrics.dashboards.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +data: +{{- range $path, $_ := .Files.Glob "dashboards/*.json" }} +{{- $filename := trimSuffix (ext $path) (base $path) }} + {{ base $path }}: |- +{{ $.Files.Get $path | indent 4 }} +{{- end }} +{{- end }} diff --git a/charts/hg612-exporter/values.yaml b/charts/hg612-exporter/values.yaml index efcdcd2..181759b 100644 --- a/charts/hg612-exporter/values.yaml +++ b/charts/hg612-exporter/values.yaml @@ -70,3 +70,12 @@ metrics: # for: 5m # labels: # severity: critical + # -- Enable and configure Grafana dashboard ConfigMaps for the chart under this key. + # @default -- See values.yaml + dashboards: + create: false + # -- Namespace to create the dashboards ConfigMap under. + # @default -- The release's namespace + namespace: + labels: + grafana_dashboard: "true"