Simple tool to query lantiq modem statistics and diagnostics, useful for modem-routers running OpenWrt's dsl_cmd

Dear all,

due to stability issues on my own link I have cobbled together a quick and dirty project to extract and display statistics and diagnostic data from my Lantiq-VRX200 modem (BT homeHub 5A, currently running OpenWrt 19.07.0). Since I would have preferred not having to do this and since, even in its rudimentary and coarse state, it might be useful to others (if only as documentation about the how to do this conceptually and how not-to-do this implementation-wise) I just put up a project on github:
https://github.com/moeller0/lantiq_dsl_parser
The values this currently offers is twofold, a) it collects and stores the DSL data and b) it plots out a few select variables, notable the SNR, bitloading, H(log) and QuietLineNoise (QLN) over the frequency bins, all plots helpful in diagnosing issues like RF noise/interference. But besides data collection and plotting it does not do any analysis.
Final caveat, the code itself will only run under octave/matlab and expects that one already configured passwordless ssh access between the host running the code and the modem. I tested this under linux and macos, but am not sure whether it will work under windows at all.

Feel free to test and report back any issues you encounter. I will not promise any quick changes or implementation of feature requests, but I will look at any issues discovered (as far as my limited time allows). ATM this has only been tested with my own VDSL2 link (ITU G99.3.5 AnnexB, VDSL2 Vectoring).

EDIT: I now figured out how to get access to ITU G998.4 G.INP/ReTx Retransmission counters (in the example shown as a retrofit for 19.07.1, but it should be simple to do the same for other versions or to build a full firmware with the required modification):

Quick and dirty instructions how to build ReTX aware components to retrofit an existing modem build to be able to query ReTx counters

First clone a new openwrt repository (or use your old one, but in that case )

  1. Install a working build system (see https://openwrt.org/docs/guide-developer/build-system/install-buildsystem)
  2. git clone https://git.openwrt.org/openwrt/openwrt.git
  3. cd ./openwrt
  4. [https://openwrt.org/docs/guide-developer/build-system/use-buildsystem](https://openwrt.org/docs/guide-developer/build-system/use-buildsystem prepare the desired version):
./scripts/feeds update -a
git fetch --tags
git tag -l
git checkout v19.07.1
  1. Edit the relevant Makefiles (openwrt/package/kernel/lantiq/ltq-vdsl/Makefile , and openwrt/package/network/config/ltq-vdsl-app/Makefile) by adding:
CONFIGURE_ARGS += \
        --enable-dsl-pm-retx-counters \
        --enable-dsl-pm-retx-thresholds

to the makefile section containing the other CONFIGURE_ARGS.
6. Opyionally copy the config.buildinfo file from the selected reference version to openwrt/.config : https://downloads.openwrt.org/releases/19.07.1/targets/lantiq/xrx200/config.buildinfo for the lantiq target and version 19.07.1
7. Run make menuconfig and edit as desired (in my case I dropped all other target devices than the lantiq_xrx200_DEVICE_bt_homehub-v5a)
8. Build the whole thing: make -sc or just the selexted relevant packages:

make package/kernel/lantiq/ltq-vdsl/{clean,compile,install} V=s
make package/network/config/ltq-vdsl-app/{clean,compile,install} V=s
  1. Get the build packages and extract the relevant files (IIRC drv_dsl_cpe_api.ko, and vdsl_cpe_control ) and move them over to the lantiq device and reboot
  2. On the lantiq device test with:
. /lib/functions/lantiq_dsl.sh ; dsl_cmd rtsg 0
. /lib/functions/lantiq_dsl.sh ; dsl_cmd rtsg 1

root@BTHH5A:~# . /lib/functions/lantiq_dsl.sh ; dsl_cmd rtsg 0
nReturn=0 nDirection=0 nRxCorruptedTotal=629 nRxUncorrectedProtected=0 nRxRetransmitted=0 nRxCorrected=629 nTxRetransmitted=744
root@ BTHH5A:~# . /lib/functions/lantiq_dsl.sh ; dsl_cmd rtsg 1
nReturn=0 nDirection=1 nRxCorruptedTotal=7115618 nRxUncorrectedProtected=6171968 nRxRetransmitted=0 nRxCorrected=943650 nTxRetransmitted=9229569

This might also be applicable to ADSL and the matching lantiq ADSL packages, but since I can not test that I refrained from even trying.

4 Likes

@mpa thanks for the clean up, :wink:

Now that you mentioned it, I actually wrote a bash script a while back to query dsl lucistat and feed the output to collectd so it can be pulled and graphed later with any front-end. But I didn't have the time to test it more.

That sounds like an excellent project. I have not yet gotten around to implement displaying stats over time at all but for stability tracking that seems quite helpful, especially if it can be easily displayed on the router itself. If you are looking for testers I happily volunteer :wink:

My current rabbit hole is trying to get G.INP/retransmit counters out of dsl_cmd, as my ISP uses these to automatically adjust my profile based on errors including uncorrected retransmits and I want to understand what is going on. And that takes longer than I expected....

P.S.: Turns out getting the ReTX statistics was not really that involved, now the challenge is to get the necessary changes (only to two to 4 makefiles) into OpenWrt proper...

sounds good, I will put it on github with explanation to everything to get it going and you can give it a try I will post the link when I have time.

1 Like

Have a look at prometheus and grafana. The former collects data, the latter visualizes it in your browser. OpenWRT already has a lua based prometheus exporter with a lantiq dsl collector (package prometheus-node-exporter-lua-ltq-dsl).

It could look like this:


I didn't visualize everything, but the data is there.

6 Likes

@dhewg nice dashboard, do you have a reference to the grafana json so I can reuse it?

Sorry for the delay, this is my current version:

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "limit": 100,
        "name": "Annotations & Alerts",
        "showIn": 0,
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 2,
  "id": 15,
  "iteration": 1587800800250,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Prometheus",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 9,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "dsl_info{instance=\"$instance\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Chipset: {{chipset}}<br>ATU-C: {{atuc_vendor_id}}<br>Firmware: {{firmware_version}}",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "DSL Info",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [],
      "valueName": "name"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Prometheus",
      "decimals": null,
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 9,
        "y": 0
      },
      "id": 20,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "100 / dsl_datarate{instance=\"$instance\", direction=\"down\"} * scalar(irate(node_network_receive_bytes_total{instance=\"$instance\", device=\"dsl0\"}[5m])) * 8",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "75,85",
      "title": "Downstream",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [],
      "valueName": "current"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Prometheus",
      "decimals": null,
      "format": "percent",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": true,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 12,
        "y": 0
      },
      "id": 22,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": true
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "100 / dsl_datarate{instance=\"$instance\", direction=\"up\"} * scalar(irate(node_network_transmit_bytes_total{instance=\"$instance\", device=\"dsl0\"}[5m])) * 8",
          "format": "time_series",
          "instant": true,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "75,85",
      "title": "Upstream",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [],
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 4,
        "w": 9,
        "x": 15,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 4,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": true,
      "targets": [
        {
          "expr": "dsl_up{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{detail}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Line State",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 0,
          "format": "short",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Prometheus",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 9,
        "x": 0,
        "y": 4
      },
      "id": 8,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "dsl_line_info{instance=\"$instance\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Annex {{annex}}<br>Mode {{mode}}",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "Line Info",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [],
      "valueName": "name"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "Prometheus",
      "format": "s",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 4,
        "w": 6,
        "x": 9,
        "y": 4
      },
      "id": 10,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "options": {},
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "expr": "dsl_uptime_seconds{instance=\"$instance\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": "",
      "title": "Line Uptime",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [],
      "valueName": "current"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 4,
        "w": 9,
        "x": 15,
        "y": 4
      },
      "hiddenSeries": false,
      "id": 24,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": false,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "dsl_latency_seconds{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{direction}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Latency",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "s",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "hiddenSeries": false,
      "id": 16,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideEmpty": false,
        "hideZero": false,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "repeatDirection": "h",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "irate(node_network_receive_bytes_total{instance=\"$instance\", device=\"dsl0\"}[5m]) * 8",
          "format": "time_series",
          "hide": false,
          "instant": false,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{device}}",
          "refId": "A"
        },
        {
          "expr": "dsl_datarate{instance=\"$instance\", direction=\"down\"}",
          "format": "time_series",
          "hide": true,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "data rate",
          "refId": "B"
        },
        {
          "expr": "dsl_max_datarate{instance=\"$instance\", direction=\"down\"}",
          "format": "time_series",
          "hide": true,
          "intervalFactor": 1,
          "legendFormat": "max. attainable data rate",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Inbound Traffic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 8
      },
      "hiddenSeries": false,
      "id": 18,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "hideZero": true,
        "max": true,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "irate(node_network_transmit_bytes_total{instance=\"$instance\", device=\"dsl0\"}[5m]) * 8",
          "format": "time_series",
          "hide": false,
          "instant": false,
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{device}}",
          "refId": "A"
        },
        {
          "expr": "dsl_datarate{instance=\"$instance\", direction=\"up\"}",
          "format": "time_series",
          "hide": true,
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "data rate",
          "refId": "B"
        },
        {
          "expr": "dsl_max_datarate{instance=\"$instance\", direction=\"up\"}",
          "format": "time_series",
          "hide": true,
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "max. attainable data rate",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Outbound Traffic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "bps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "decbytes",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 17
      },
      "hiddenSeries": false,
      "id": 12,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "dsl_line_attenuation_db{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "line attenuation {{direction}}",
          "refId": "A"
        },
        {
          "expr": "dsl_signal_attenuation_db{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "signal attenuation {{direction}}",
          "refId": "B"
        },
        {
          "expr": "dsl_signal_to_noise_margin_db{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "noise margin {{direction}}",
          "refId": "C"
        },
        {
          "expr": "dsl_aggregated_transmit_power_db{instance=\"$instance\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "aggregated transmit power  {{direction}}",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "dB Measurements",
      "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": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Prometheus",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 17
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "avg": false,
        "current": false,
        "hideEmpty": true,
        "hideZero": true,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "irate(dsl_error_seconds_total{instance=\"$instance\"}[5m])",
          "format": "time_series",
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{err}} {{loc}}",
          "refId": "A"
        },
        {
          "expr": "-irate(dsl_errors_total{instance=\"$instance\"}[5m])",
          "format": "time_series",
          "interval": "",
          "intervalFactor": 1,
          "legendFormat": "{{err}} {{loc}}",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Errors",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "1m",
  "schemaVersion": 22,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "datasource": "Prometheus",
        "definition": "label_values(dsl_info, instance)",
        "hide": 0,
        "includeAll": false,
        "label": "Host",
        "multi": false,
        "name": "instance",
        "options": [],
        "query": "label_values(dsl_info, instance)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "OpenWRT DSL Stats",
  "uid": "s91DdGEik",
  "version": 15
}

1 Like

Ok great thanks! I was actually writing a simple collectd script to scrape those metrics. I've wrapped up a dashboard myself with that one already.

Package prometheus-node-exporter-lua-ltq-dsl not found?

1 Like

can someone please tell the packages to monitor vdsl stats?

I too wanted the DSL stats, and the package for this isn't currently being built, however I've worked around this issue as follows and have managed to get the stats from the Lantiq DSL prometheus exporter working as follows:

# Install wget
opkg install wget
# Download the source lua file to correct location
cd /usr/lib/lua/prometheus-collectors
wget --no-check-certificate https://raw.githubusercontent.com/rs/openwrt-packages/master/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/ltq-dsl.lua
# Set permissions
chmod +x ltq-dsl.lua
# Restart exporter
/etc/init.d/prometheus-node-exporter-lua restart

# Prove DSL metrics are now included:
wget -q -O - 192.168.1.254:9100/metrics | grep dsl_
# Which then returns metrics which match those in the UI/command line

# TYPE dsl_line_attenuation_db gauge
# TYPE dsl_signal_attenuation_db gauge
# TYPE dsl_signal_to_noise_margin_db gauge
# TYPE dsl_aggregated_transmit_power_db gauge
# TYPE dsl_latency_seconds gauge
# TYPE dsl_datarate gauge
# TYPE dsl_max_datarate gauge
# TYPE dsl_error_seconds_total counter
# TYPE dsl_errors_total counter
# TYPE dsl_info gauge
dsl_info{chipset="Lantiq-VRX200",atuc_system_vendor_id="Broadcom",api_version="4.17.18.6",atuc_vendor_id="Broadcom 193.144",firmware_version="5.8.1.8.1.6"} 1
# TYPE dsl_line_info gauge
dsl_line_info{xtse3="0",xtse4="0",xtse8="2",xtse5="0",xtse6="0",xtse7="0",profile="17a",xtse2="0",xtse1="0",mode="G.993.2 (VDSL2)",annex="B"} 1
# TYPE dsl_up gauge
dsl_up{detail="showtime_tc_sync"} 1
# TYPE dsl_uptime_seconds gauge
dsl_uptime_seconds{} 60586
dsl_line_attenuation_db{direction="down"} 14.0
dsl_line_attenuation_db{direction="up"} 15.3
dsl_signal_attenuation_db{direction="down"} 14.0
dsl_signal_attenuation_db{direction="up"} 15.1
dsl_signal_to_noise_margin_db{direction="down"} 4.1
dsl_signal_to_noise_margin_db{direction="up"} 11.8
dsl_aggregated_transmit_power_db{direction="down"} 5.9
dsl_aggregated_transmit_power_db{direction="up"} 13.2
dsl_latency_seconds{direction="down"} 0.00016
dsl_latency_seconds{direction="up"} 0
dsl_datarate{direction="down"} 79903000
dsl_datarate{direction="up"} 19999000
dsl_max_datarate{direction="down"} 85497512
dsl_max_datarate{direction="up"} 29406000

Thanks for your efforts, but from what I understand dsl_control doesn't work anymore in the latest OpenWrt 21.02 release candidates.

So major changes are needed for the Lantiq DSL prometheus exporter to work with latest OpenWrt 21.02

1 Like