diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca8047a --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# HG612 Prometheus Exporter + +## Usage + +``` +NAME: + hg612 prometheus exporter - a metrics exporter for the hg612 + +USAGE: + main [global options] command [command options] [arguments...] + +COMMANDS: + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + --host value the fully qualified host for the hg612 modem + --identifier value the identifier for the line and modem + --bind value the bind string for the http server ie :8080 (default: ":8080") + --interval value the interval between collection in seconds (default: 10) + --help, -h show help (default: false) +``` + +## Dashbaord + +![](https://raw.githubusercontent.com/jakekeeys/hg612-exporter/master/resources/dashboard.png) + +## Metrics +| Metric | Type | Lables | +| --- | --- | --- | +| dsl_down_attenuation | gauge | `host` `identifier` | +| dsl_down_crc | gauge | `host` `identifier` | +| dsl_down_crc_2 | gauge | `host` `identifier` | +| dsl_down_current_rate | gauge | `host` `identifier` | +| dsl_down_current_rate_2 | gauge | `host` `identifier` | +| dsl_down_fec | gauge | `host` `identifier` | +| dsl_down_fec_2 | gauge | `host` `identifier` | +| dsl_down_hec | gauge | `host` `identifier` | +| dsl_down_hec_2 | gauge | `host` `identifier` | +| dsl_down_max_rate | gauge | `host` `identifier` | +| dsl_down_power | gauge | `host` `identifier` | +| dsl_down_snr | gauge | `host` `identifier` | +| dsl_status | gauge | `host` `identifier` `status` `modulation` `dataPath` | +| dsl_up_attenuation | gauge | `host` `identifier` | +| dsl_up_crc | gauge | `host` `identifier` | +| dsl_up_crc_2 | gauge | `host` `identifier` | +| dsl_up_current_rate | gauge | `host` `identifier` | +| dsl_up_current_rate_2 | gauge | `host` `identifier` | +| dsl_up_fec | gauge | `host` `identifier` | +| dsl_up_fec_2 | gauge | `host` `identifier` | +| dsl_up_hec | gauge | `host` `identifier` | +| dsl_up_hec_2 | gauge | `host` `identifier` | +| dsl_up_max_rate | gauge | `host` `identifier` | +| dsl_up_power | gauge | `host` `identifier` | +| dsl_up_snr | gauge | `host` `identifier` | diff --git a/resources/dashboard.json b/resources/dashboard.json new file mode 100644 index 0000000..e588971 --- /dev/null +++ b/resources/dashboard.json @@ -0,0 +1,991 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 23, + "iteration": 1580046064178, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 4, + "panels": [], + "title": "DSL", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "-dsl_up_current_rate{identifier=~\"$identifier\",host=~\"$host\"}", + "legendFormat": "Up: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "dsl_down_current_rate{identifier=~\"$identifier\",host=~\"$host\"}", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Line Rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Kbits", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 1 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "-dsl_up_max_rate{identifier=~\"$identifier\",host=~\"$host\"}", + "legendFormat": "Up: {{host}}/{{identifier}}", + "refId": "B" + }, + { + "expr": "dsl_down_max_rate{identifier=~\"$identifier\",host=~\"$host\"}", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Attainable Rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Kbits", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 0, + "y": 10 + }, + "hiddenSeries": false, + "id": 5, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "dsl_up_snr{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "dsl_down_snr{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "SNR", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dB", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 8, + "y": 10 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "dsl_up_attenuation{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "dsl_down_attenuation{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Attenuation", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dB", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 16, + "y": 10 + }, + "hiddenSeries": false, + "id": 7, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "dsl_up_power{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "dsl_down_power{identifier=~\"$identifier\",host=~\"$host\"}/10", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Power", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dBm", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 0, + "y": 19 + }, + "hiddenSeries": false, + "id": 9, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(dsl_down_crc{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "rate(dsl_up_crc{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CRC Errors", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 8, + "y": 19 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(dsl_down_fec{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "rate(dsl_up_fec{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "FEC Errors", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 9, + "w": 8, + "x": 16, + "y": 19 + }, + "hiddenSeries": false, + "id": 11, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(dsl_down_hec{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "UP: {{host}}/{{identifier}}", + "refId": "A" + }, + { + "expr": "rate(dsl_up_hec{identifier=~\"$identifier\",host=~\"$host\"}[$interval])", + "legendFormat": "Down: {{host}}/{{identifier}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "HEC Errors", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "schemaVersion": 21, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "auto": true, + "auto_count": 30, + "auto_min": "10s", + "current": { + "selected": false, + "text": "auto", + "value": "$__auto_interval_interval" + }, + "hide": 0, + "label": "interval", + "name": "interval", + "options": [ + { + "selected": true, + "text": "auto", + "value": "$__auto_interval_interval" + }, + { + "selected": false, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "10m", + "value": "10m" + }, + { + "selected": false, + "text": "30m", + "value": "30m" + }, + { + "selected": false, + "text": "1h", + "value": "1h" + }, + { + "selected": false, + "text": "6h", + "value": "6h" + }, + { + "selected": false, + "text": "12h", + "value": "12h" + }, + { + "selected": false, + "text": "1d", + "value": "1d" + }, + { + "selected": false, + "text": "7d", + "value": "7d" + }, + { + "selected": false, + "text": "14d", + "value": "14d" + }, + { + "selected": false, + "text": "30d", + "value": "30d" + } + ], + "query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d", + "refresh": 2, + "skipUrlSync": false, + "type": "interval" + }, + { + "allValue": null, + "current": { + "tags": [], + "text": "All", + "value": [ + "$__all" + ] + }, + "datasource": "Prometheus", + "definition": "label_values(dsl_status, identifier)", + "hide": 0, + "includeAll": true, + "label": "identifier", + "multi": true, + "name": "identifier", + "options": [ + { + "selected": true, + "text": "All", + "value": "$__all" + }, + { + "selected": false, + "text": "bt", + "value": "bt" + }, + { + "selected": false, + "text": "tt-0", + "value": "tt-0" + }, + { + "selected": false, + "text": "tt-1", + "value": "tt-1" + } + ], + "query": "label_values(dsl_status, identifier)", + "refresh": 0, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": null, + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": "Prometheus", + "definition": "label_values(dsl_status, host)", + "hide": 0, + "includeAll": true, + "label": "host", + "multi": true, + "name": "host", + "options": [ + { + "selected": true, + "text": "All", + "value": "$__all" + }, + { + "selected": false, + "text": "farm-modem.yonsea.co.uk", + "value": "farm-modem.yonsea.co.uk" + }, + { + "selected": false, + "text": "10.10.1.1", + "value": "10.10.1.1" + }, + { + "selected": false, + "text": "office-modem.yonsea.co.uk", + "value": "office-modem.yonsea.co.uk" + }, + { + "selected": false, + "text": "living-room-modem.yonsea.co.uk", + "value": "living-room-modem.yonsea.co.uk" + } + ], + "query": "label_values(dsl_status, host)", + "refresh": 0, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "HG612", +} \ No newline at end of file diff --git a/resources/dashboard.png b/resources/dashboard.png new file mode 100644 index 0000000..d3eb57e Binary files /dev/null and b/resources/dashboard.png differ diff --git a/resources/manifest.yaml b/resources/manifest.yaml new file mode 100644 index 0000000..7b28e36 --- /dev/null +++ b/resources/manifest.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hg612-exporter +spec: + strategy: + type: Recreate + replicas: 1 + selector: + matchLabels: + app: hg612-exporter + template: + metadata: + labels: + app: hg612-exporter + annotations: + prometheus.io/scrape: 'true' + prometheus.io/port: '8080' + prometheus.io/path: '/prometheus' + spec: + containers: + - image: quay.io/jakekeeys/hg612-exporter:latest + imagePullPolicy: Always + name: hg612-exporter + args: + - --host + - host + - --identifier + - id + ports: + - containerPort: 8080 + resources: + requests: + memory: 25Mi + limits: + memory: 50Mi \ No newline at end of file