Configuration and scripts to collect and plot DSL line statistics in OpenWrt with LuCI using collectd and rrdtool.
OpenWrt provides the /etc/init.d/dsl_control
script to query the current DSL
parameters. With the scripts and configuration described below, one can
collect and plot the values, e.g., in order to analyze stability issues.
If you are unfamiliar with OpenWrt/LuCI's statistics support, check the
OpenWrt wiki page on luci-app-statistics.
The following guide assumes, that you have statistics basically setup
and the package luci-app-statistics
installed.
Furthermore, this setup was tested with the rrdtool support from the package
collectd-mod-rrdtool
which was configured to write to a USB drive in order to
avoid flash wear. Check the
OpenWrt wiki page about how to add a USB drive
for details.
Setup data collection:
- Install packages: collectd-mod-exec shadow-useradd sudo
- Copy the
collect-dsl
script into/usr/sbin/
and make it executable. - Add a new user to run
collect-dsl
as:useradd -r -s /bin/false -d /var collector
- Copy
sudoers
into the new file/etc/sudoers.d/collector
to allow execution ofcollect-dsl
with privileges. - Configure collectd's exec module to execute the command
/usr/bin/sudo -E /usr/sbin/collect-dsl
with usercollector
and groupcollector
.
This should be enough to get the data collected. Rrdtool's storage directory
should now contain a dsl-dsl0/
directory with several .rrd files.
Rrdtool provides commands to check the contents of .rrd files.
Some useful links for development:
- OpenWrt wiki page about the exec module
- Manpage of collectd's exec module
- Explanation of data sources/types in collectd
- File
/usr/share/collectd/types.db
with actual data type definitions.
Plotting is based on the package luci-app-statistics
.
To plot the collected data in LuCI simply copy dsl.lua
into
/usr/lib/lua/luci/statistics/rrdtool/definitions/
.
After refreshing the graph page, it should show a "DSL" tab with many plots of signal strengths, data rates, and transmission errors.
If you want to change the plot appearence, do not forget to delete
/tmp/luci-indexcache
and /tmp/luci-modulecache/
before refreshing.