Is it possible to make a Luci page that pulls stats from an other device on the network?

#1

I am wondering is it possible to make a Luci page that can telnet (via nc) or ssh to an other device like a modem, automatically run some commands (maybe once every few seconds), scrape the output (stuff like connection stats) and then display them?

#2

You could develop a package for that, and add LuCI support.

#3

Normal LuCI statistics app has built-in networking capability, so that you can collect data from several routers to be displayed at one. I assume that you have already tested that?

(You may need to have some as additional collectd-mod-... packages installed to get all the metrics that you want. The basic luci-app-statistics installs some of those, but not all)

But that assumes that you can get collectd to run in those other devices. Easy if they are OpenWrt devices, but may not be feasible for 3rd party devices

#4

The other device is broadcom based (so no DSL driver, even though OpenWRT can run on it).
What I was thinking was writing a simple shell script to pull the data, write it to a tmp file and then somehow make a luci page to display it's contents.

The info I want to display is something like this:

Mode:                   ADSL2+
TPS-TC:                 ATM Mode
Trellis:                U:ON /D:ON
Line Status:            No Defect
Training Status:        Showtime
                Down            Up
SNR (dB):        7.9             6.0
Attn(dB):        51.0            32.1
Pwr(dBm):        18.6            12.2

                        ADSL2 framing
                        Bearer 0
MSGc:           58              12
B:              58              13
M:              4               16
T:              3               9
R:              10              10
S:              1.3452          6.6857
L:              1463            280
D:              32              8

                        Counters
                        Bearer 0
SF:             6672779         416603
SFErr:          167             49
RS:             320293309               4282835
RSCorr:         3217205         4332
RSUnCorr:       2290            0

                        Bearer 0
HEC:            2211            108
OCD:            0               0
LCD:            0               0
Total Cells:    1418152071              270193496
Data Cells:     32127222                5234743
Drop Cells:     0
Bit Errors:     0               12226

ES:             89              27
SES:            1               2
UAS:            30              30
AS:             107714

                        Bearer 0
INP:            0.50            1.00
INPRein:        0.00            0.00
delay:          10              13
PER:            16.14           16.92
OR:             31.71           8.50

Bitswap:        0/0             0/23429

No fancy graphs or anything.

#5

Some good tips here;

Depending on whether you want;

-login
-lua
-other langs

you might head in different directions.....

Then there is the timing aspect....;

-ui refresh driven vs cron vs at etc. etc.

i've got some basic bash graphing ( rrd ) scripts if you head in that direction I might be able to find them if you run into trouble...