Viktor Jaep
Part of the Furniture
Lol, you know how to find them alright! Almost seems like your IP is blank?? If you stop/restart the script, does it look normal again? Let me build in some additional error catching on that one.
Lol, you know how to find them alright! Almost seems like your IP is blank?? If you stop/restart the script, does it look normal again? Let me build in some additional error catching on that one.
Ahhh. Yep. The menu is active even though it doesn't appear on screen yet, and hitting the N key was preventing it from grabbing necessary data (like your IP) before it could draw them on screen. This "feature" of hitting menu items on startup has been bugging me too... I'll get this fixed.Answer ... hitting the "N' key before:-
[Initiating Boot Sequence - Gathering Initial Stats...]
has completely finished its run ...
Probably needs to loop around into Gathering Initial Stats again, or ignore the key until "gather" has finished ...
Sorry @Viktor Jaep , in a mischievous mood tonight
Yes, starts up normally on another run ...If you stop/restart the script, does it look normal again?
I'll get this fixed
VERY TRUE!! LOLYour OCD wouldn't allow otherwise!
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/RTRMON/master/rtrmon-1.12.sh" -o "/jffs/scripts/rtrmon.sh" && chmod a+rx "/jffs/scripts/rtrmon.sh"
I don't see a way to force it to use IPv6, so I'm guessing it uses whatever is available. Are you pure IPv6 on your end?You're using the latest from ookla, which prefers/defaults to IPv6 when that connectivity is available?
No, Dual stack...but I'm starting to see more traffic on the 6 side than the 4.I don't see a way to force it to use IPv6, so I'm guessing it uses whatever is available. Are you pure IPv6 on your end?
cat: can't open '/sys/class/net//statistics/rx_bytes': No such file or directory
cat: can't open '/sys/class/net//statistics/tx_bytes': No such file or directory
Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]
[ CONFFLAG-LIST ]
ip address del IFADDR dev IFNAME [mngtmpaddr]
ip address {show|save|flush} [ dev IFNAME ] [ scope SCOPE-ID ]
[ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up]
ip address {showdump|restore}
IFADDR := PREFIX | ADDR peer PREFIX
[ broadcast ADDR ] [ anycast ADDR ]
[ label IFNAME ] [ scope SCOPE-ID ]
SCOPE-ID := [ host | link | global | NUMBER ]
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG := [ permanent | dynamic | secondary | primary |
[-]tentative | [-]deprecated | [-]dadfailed | temporary |
CONFFLAG-LIST ]
CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG
CONFFLAG := [ home | nodad | mngtmpaddr | noprefixroute | autojoin ]
LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]
LFT := forever | SECONDS
cat: can't open '/sys/class/net//statistics/rx_bytes': No such file or directory
cat: can't open '/sys/class/net//statistics/tx_bytes': No such file or directory
____ __________ __ _______ _ __
/ __ \/_ __/ __ \/ |/ / __ \/ | / / v1.12
/ /_/ / / / / /_/ / /|_/ / / / / |/ / (S)etup
/ _, _/ / / / _, _/ / / / /_/ / /| / (N)ext Page (1/3)
/_/ |_| /_/ /_/ |_/_/ /_/\____/_/ |_/ (E)xit
___
/CPU\______________________________________________________________
Uptime [ 012d 03h 15m 54s ]
CPU Load [ 1m: 1.11 5m: 1.12 15m: 1.09 ]
CPU User [ ] 0.00 % / 0%
CPU System [ ] 1.17 % / 1%
CPU Nice [ ] 0.00 % / 0%
CPU Idle [|||||||||||||||||||||||||||||||||| ] 98.78 % / 98%
CPU Temp [||||||||||||||||| ] 64 C / 49%
______
/Memory\___________________________________________________________
Mem Used [|||||||||||||| ] 382 MB / 41%
Mem Free [|||||||||||||||||||| ] 529 MB / 58%
Mem Shared [ ] 3 MB / 0%
Mem Buffer [ ] 0 MB / 0%
Mem Cache [|| ] 67 MB / 7%
NVRAM Used [|||||||||||||||||||| ] 75768 B / 57%
____
/Disk\_____________________________________________________________
JFFS Used [||||| ] 8 MB / 17%
./rtrmon.sh: line 1570: divide by zero
Hum! Interesting one... So, yeah... I'm not quite sure if the stock Asus firmware has the necessary NVRAM variables to reference in order to pull stats for them... As information seems to be missing for these required variables, you start running into calculations that will yield division by zero. For your error above, it looks like it's having trouble getting the interface names for your W0 and W1 interfaces... I grab these using these 2 commands:@Viktor Jaep Great utility, mainly came for the Speed test capability, but want to stay for the enchilada.
Running to into a problem
I'm getting a 'divide by zero" error @ 1570, which has a 'Done' command in the script.
View attachment 43558
I'm rocking the default ASUS code (no Merlin) so I don't know if it is supposed to run in this environment or not. It isn't exactly clear.
An interesting side effect is before it hits that error, it flashes over to a "ip command" help/usage screen.
*note: the two errors for the rx/tx_bytes happen on script startup but don't seem related, probably because I'm still running the stock ASUS binaries.
Code:cat: can't open '/sys/class/net//statistics/rx_bytes': No such file or directory cat: can't open '/sys/class/net//statistics/tx_bytes': No such file or directory Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ] [ CONFFLAG-LIST ] ip address del IFADDR dev IFNAME [mngtmpaddr] ip address {show|save|flush} [ dev IFNAME ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up] ip address {showdump|restore} IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label IFNAME ] [ scope SCOPE-ID ] SCOPE-ID := [ host | link | global | NUMBER ] FLAG-LIST := [ FLAG-LIST ] FLAG FLAG := [ permanent | dynamic | secondary | primary | [-]tentative | [-]deprecated | [-]dadfailed | temporary | CONFFLAG-LIST ] CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG CONFFLAG := [ home | nodad | mngtmpaddr | noprefixroute | autojoin ] LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ] LFT := forever | SECONDS cat: can't open '/sys/class/net//statistics/rx_bytes': No such file or directory cat: can't open '/sys/class/net//statistics/tx_bytes': No such file or directory ____ __________ __ _______ _ __ / __ \/_ __/ __ \/ |/ / __ \/ | / / v1.12 / /_/ / / / / /_/ / /|_/ / / / / |/ / (S)etup / _, _/ / / / _, _/ / / / /_/ / /| / (N)ext Page (1/3) /_/ |_| /_/ /_/ |_/_/ /_/\____/_/ |_/ (E)xit ___ /CPU\______________________________________________________________ Uptime [ 012d 03h 15m 54s ] CPU Load [ 1m: 1.11 5m: 1.12 15m: 1.09 ] CPU User [ ] 0.00 % / 0% CPU System [ ] 1.17 % / 1% CPU Nice [ ] 0.00 % / 0% CPU Idle [|||||||||||||||||||||||||||||||||| ] 98.78 % / 98% CPU Temp [||||||||||||||||| ] 64 C / 49% ______ /Memory\___________________________________________________________ Mem Used [|||||||||||||| ] 382 MB / 41% Mem Free [|||||||||||||||||||| ] 529 MB / 58% Mem Shared [ ] 3 MB / 0% Mem Buffer [ ] 0 MB / 0% Mem Cache [|| ] 67 MB / 7% NVRAM Used [|||||||||||||||||||| ] 75768 B / 57% ____ /Disk\_____________________________________________________________ JFFS Used [||||| ] 8 MB / 17% ./rtrmon.sh: line 1570: divide by zero
nvram get wl0_ifname
nvram get wl1_ifname
/sys/class/net//statistics/rx_bytes
ip -V
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wl0_ifname
eth6
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wl1_ifname
eth7
adahnert@RT-AX86U-B498:/tmp/home/root# cd /sys
adahnert@RT-AX86U-B498:/sys# cd class
adahnert@RT-AX86U-B498:/sys/class# cd net
adahnert@RT-AX86U-B498:/sys/class/net# ls
bcmsw dpsta eth2 eth5 ifb0 imq1 ip6tnl0 spu_ds_dummy wl1.1
bcmswlpbk0 eth0 eth3 eth6 ifb1 imq2 lo spu_us_dummy wl1.2
br0 eth1 eth4 eth7 imq0 ip6gre0 sit0 wl0.1
adahnert@RT-AX86U-B498:/sys/class/net#
adahnert@RT-AX86U-B498:/sys/class/net# ls -lat
lrwxrwxrwx 1 adahnert root 0 Aug 15 10:08 wl0.1 -> ../../devices/platform/80050000.pcie/pci0001:00/0001:00:00.0/0001:01:00.0/net/wl0.1
lrwxrwxrwx 1 adahnert root 0 Aug 15 10:08 wl1.1 -> ../../devices/platform/80040000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wl1.1
lrwxrwxrwx 1 adahnert root 0 Aug 15 10:08 wl1.2 -> ../../devices/platform/80040000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wl1.2
lrwxrwxrwx 1 adahnert root 0 May 5 2018 br0 -> ../../devices/virtual/net/br0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 dpsta -> ../../devices/virtual/net/dpsta
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth6 -> ../../devices/platform/80050000.pcie/pci0001:00/0001:00:00.0/0001:01:00.0/net/eth6
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth7 -> ../../devices/platform/80040000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/eth7
drwxr-xr-x 2 adahnert root 0 Dec 31 1969 .
drwxr-xr-x 27 adahnert root 0 Dec 31 1969 ..
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 ifb0 -> ../../devices/virtual/net/ifb0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 ifb1 -> ../../devices/virtual/net/ifb1
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 imq0 -> ../../devices/virtual/net/imq0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 imq1 -> ../../devices/virtual/net/imq1
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 imq2 -> ../../devices/virtual/net/imq2
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 ip6gre0 -> ../../devices/virtual/net/ip6gre0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 ip6tnl0 -> ../../devices/virtual/net/ip6tnl0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 sit0 -> ../../devices/virtual/net/sit0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 bcmsw -> ../../devices/virtual/net/bcmsw
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 bcmswlpbk0 -> ../../devices/virtual/net/bcmswlpbk0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth0 -> ../../devices/virtual/net/eth0
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth1 -> ../../devices/virtual/net/eth1
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth2 -> ../../devices/virtual/net/eth2
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth3 -> ../../devices/virtual/net/eth3
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth4 -> ../../devices/virtual/net/eth4
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 eth5 -> ../../devices/virtual/net/eth5
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 spu_ds_dummy -> ../../devices/virtual/net/spu_ds_dummy
lrwxrwxrwx 1 adahnert root 0 Dec 31 1969 spu_us_dummy -> ../../devices/virtual/net/spu_us_dummy
adahnert@RT-AX86U-B498:/sys/class/net# ip -V
ip utility, iproute2-ss151103
Output from the 'nvram' commands:After a little investigation....
the variable WANIFNAME ends up being blank after the call from get_wan_setting.
so looking into the function... 'get_wan_setting' is setting ${varval} to blank
which makes sense (at least based upon my understanding of the code), because my call to 'nvram get wan0_ifname' is empty.
Please take this with a grain of salt and that I could be misunderstanding the code too.
Oh, and also. there is no 'nano' on this device, so the log function fails.
And this still doesn't address the divide by zero problem (haven't investigated yet)
So, with that being said. Let me know what I should look into next.
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wans_mode
fb
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan0_primary
1
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan0_proto
dhcp
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan0_ifname
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan1_primary
0
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan1_proto
dhcp
adahnert@RT-AX86U-B498:/tmp/home/root# nvram get wan1_ifname
adahnert@RT-AX86U-B498:/tmp/home/root#
adahnert@RT-AX86U-B498:/sys/class/net# nvram get wl0_ifname
eth6
adahnert@RT-AX86U-B498:/sys/class/net# nvram get wl1_ifname
eth7
adahnert@RT-AX86U-B498:/sys/class/net# cat eth6/statistics/rx_bytes
0
adahnert@RT-AX86U-B498:/sys/class/net# cat eth6/statistics/tx_bytes
1213290
adahnert@RT-AX86U-B498:/sys/class/net# cat eth7/statistics/rx_bytes
0
adahnert@RT-AX86U-B498:/sys/class/net# cat eth7/statistics/tx_bytes
1174544
adahnert@RT-AX86U-B498:/sys/class/net# cat eth5/statistics/rx_bytes
3508049175
adahnert@RT-AX86U-B498:/sys/class/net# cat eth5/statistics/tx_bytes
7784944207
Date [ Tue Aug 16 10:47:54 CDT 2022
Server [ Spectrum - Fort Worth, TX
Latency [ 11.495 (ms)
Jitter [ 0.619 (ms)
PacketLoss [ 0 (%)
Download [ 949 (Mbps)
Upload [ 1241 (Mbps)
DL vs WAN [||||||||||||||||||||||| ] 949 Mbps / 67%
UL vs WAN [||||||||||||||||||||||||||||||| ] 1241 Mbps / 88%
(I)nitiate Speedtest
You are correct. I was looking for the first instance of /statistics/rx_bytes, and wifi was first on my list. But it could very well be referring to your WAN statistics, as I wasn't able to see a screenshot of your page (2) which shows those stats.the variable WANIFNAME ends up being blank after the call from get_wan_setting.
so looking into the function... 'get_wan_setting' is setting ${varval} to blank
which makes sense (at least based upon my understanding of the code), because my call to 'nvram get wan0_ifname' is empty.
Bah. Are you able to install packages? "opkg install nano"?Please take this with a grain of salt and that I could be misunderstanding the code too.
Oh, and also. there is no 'nano' on this device, so the log function fails.
Yeah it gets kinda addicting after a while.Guess I should really get some work done....however, this is a bit more fun. Great stuff Viktor, been learning a lot.
I concur with your findings... problem is, those nvram and ip command calls work perfectly fine on Merlin... so I'm going to chalk it up to incompatibility.the ip address flash is the due to the WANIFNAME being blank and it fails the ip6 command 'ip -o -6 addr list ...' call. the following call to 'br0' works just fine, the command is ok. just missing the name of the wan interface.
I would agree with you on that as well.. you should be seeing numbers there if they are actively in use. But who knows, perhaps stock Asus hides these numbers in other places for its own internal use.Second thing:
Not sure where everything is supposed to line up, but I know that eth5 is supposed to be the 2.5gbe port, at least that is my working assumption. but the following below is strange.
I wouldn't think that rx would be zero for both wireless interfaces.
I'm so glad you were at least able to get *something* out of this... lol. Enjoy! Nice speeds, btw.And by the way if I hard code a start for Page 3 the speedtest, works reasonably well.
Code:Date [ Tue Aug 16 10:47:54 CDT 2022 Server [ Spectrum - Fort Worth, TX Latency [ 11.495 (ms) Jitter [ 0.619 (ms) PacketLoss [ 0 (%) Download [ 949 (Mbps) Upload [ 1241 (Mbps) DL vs WAN [||||||||||||||||||||||| ] 949 Mbps / 67% UL vs WAN [||||||||||||||||||||||||||||||| ] 1241 Mbps / 88% (I)nitiate Speedtest
adahnert@RT-AX86U-B498:/tmp/home/root# free
total used free shared buffers cached
Mem: 933840 395124 538716 2316 0 78248
-/+ buffers/cache: 316876 616964
Swap: 0 0 0
adahnert@RT-AX86U-B498:/tmp/home/root#
Cool... Thanks for the info. I'll see if I can plug up these holes if they don't return with any info so it doesn't bomb the script. Thanks for passing on this info!Hey Viktor...
Hope it's cool passing this info here, (stock vs merlin forum). I figured since it is your script, this seemed the right place and it might help everyone.
Pushing on, I don't seem to have any Swap file, I seem to remember an option for enabling/displaying Swap information. But since I'm running in "AP mode" and not "Router mode", I no longer have that option/visibility, among many other features.
Code:adahnert@RT-AX86U-B498:/tmp/home/root# free total used free shared buffers cached Mem: 933840 395124 538716 2316 0 78248 -/+ buffers/cache: 316876 616964 Swap: 0 0 0 adahnert@RT-AX86U-B498:/tmp/home/root#
However that uncovered a bug in your script. The progressbar() function doesn't like a zero passed as the max number ($2), instant divide by zero. I modified it so that if it comes in as a zero I assign it 100. Makes it look like the rest of the menus
View attachment 43595
On the WANIFNAME, I check to see if it is valid and if it isn't I stuff in my IFACE "eth5", might make it some kind of override/default, in order to make it more robust.
I've never written anything this complex in bash/script, so it is pretty cool.
Can't install nano, opkg isn't installed, still stock. And from what I understand Entware and Asus don't play nice (DownloadMaster).Bah. Are you able to install packages? "opkg install nano"?
...
I'm so glad you were at least able to get *something* out of this... lol. Enjoy! Nice speeds, btw.
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!