Well, here's the BIG script. I think this did almost everything, including
controlling the MLPPP state on my "Tomato" based router, monitoring line quality on the two modems, and rebooting them, swapping lines between them, or whatever else it deemed necessary to recover from a service outage.
All of that logic is probably not useful or interesting to you. But the parts that could be useful, are the "getinfo" pieces, which scrape DSL line info from the modems. There are several of those functions, for different modems and different methods (some modems have bugs whereby one method stops working after a while.. quite the flaky universe, DSL):
td8xxx_getinfo_www: for some TP-Link modems (eg. td8840, td8841).
td8xxx_getinfo_telnet: for some TP-Link modems.
td8xxx_getinfo: calls one of the above, depending..
td8616_getinfo: for the TP-Link td8616 modem.
speedtouch_getinfo: for Thomson Speedtouch modems.
speedstream_getinfo: for some Efficient Networks Speedstream modems.
Those parts can likely be ripped out and used separately with a bit of work.
The IP addresses, user-names, and passwords will need updating in the script to match whatever the modems are set up with.
There are similar functions within the master script for reset/reboot etc.. too.