Collectd-mod-exec script to retrieve DSL values from ZyXEL VMG1312 modem

To whom it may be of use: I recently switched to a ZyXEL VMG1312-B30A modem attached to my router and, obviously, I wanted to get the DSL line values into collectd.

Here is my result: A script that pulls the data via netcat (emulating telnet) and offers them to collectd-mod-exec with meaningful values:

This is the result, displayed in LuCI:

Can you consider SSH support?

I hear you, I actually tried SSH first. But

a) the ZyXEL appears not to speak any of the ciphers OpenWrt's own dropbear-ssh client comes with (it bombs out with No matching algo enc c->s)
b) the shell opened by ssh is actually more restricted than the shell opened by telnet, and some weird rights issue prevents the execution of xdslctl

There are technicolor modem that are based on openwrt and with some hack can have SSH access. This would be very useful or this is specific to zyxel?

Just out of curiosity, did you consider using snmp (that might be more widely available)?

It is mostly specific to the output of the Broadcom xdslctl utility which delivers a certain output. Chances are it will work for other Broadcom-based modems, but I have no way of knowing that.

To be clear: None of what I am doing here is rocket surgery, it's just a shell script retrieving the output from the modem and some parsing into usable values. The point of releasing it to the public is ... to save someone the time to do it themselves, or even just as a pointer how to parse values from a multi-line file.

xdslctl output is very standard (unless the oem modify it)
@slh snmp most of the time is bugged on this broadcom platform... (problem with driver updating the stats in the right time)

Honestly, I did not. Partly because I wanted to go about it with what is built into default OpenWrt (hence netcat and not some installable telnet client), partly because I am utterly unfamiliar with SMNP.

1 Like

Simple Network Management Protocol ( SNMP ) is one of the oldest (since the 80s) and most widely used Internet Standard protocol for collecting and organizing information about managed devices on IP networks.
With Openwrt you just have to install the SNMP package and you're in business.
Then use the SNMPWALK tool to find what metrics are provided by your device.


The graphs in the screenshot above were built years ago using SNMP metrics retrieved from an ancient Zhone 6211 DSL modem.

1 Like

In the meantime I tried. The ZyXEL VMG1312-B30A does not offer SNMP access (edit: at least not with my firmware, the "SNMP" config screen mentioned in the manual is simply missing, and there is no snmpd running or even to be found anywhere in the file system.)

And even if it did, the snmpwalk output of the related (but not identical) "B10A" variant suggests that it would only expose router-related statistics, not DSL modem statistic.

Also, there is a "dslstats" software to be used with Broadcom modems which ... does exactly what I do: retrieve statistics via telnet. However, the website has a compability list with a bunch of modems where my approach, inelegant as it is, might work too.

I don't own one myself so I can't offer any support for it.
I was just talking about SNMP in general, that it's preferred if available.

I completely understand what you mean, same case with Lantiq based routers with OpenWRT.
I can get the router-related stats via SNMP but not the DSL modem stats, need to use Prometheus node exporter for that.

1 Like