pyrovski / wrtbwmon

Linux bandwidth monitor with per-device tracking
Other
178 stars 47 forks source link

Doesn't work :( #2

Closed valentt closed 9 years ago

valentt commented 9 years ago

Any ideas why it doesn't work on OpenWrt?

Here is output with debugging in bash turned on:

./wrtbwmon.sh update /root/usage.db 
+ trap unlock; exit 1 SIGINT
+ chains=INPUT OUTPUT FORWARD
+ DEBUG=
+ tun=
+ DB=/root/usage.db
+ header=#mac,ip,iface,peak_in,peak_out,offpeak_in,offpeak_out,total,first_date,last_date
+ [ -z /root/usage.db ]
+ [ ! -f /root/usage.db ]
+ [ ! -w /root/usage.db ]
+ lock
+ attempts=0
+ [ 0 -lt 10 ]
+ [ -f /tmp/wrtbwmon.lock ]
+ echo 8948
+ read lockPID
+ [[ 8948 -eq 8948 ]]
+ break
+ iptables -t mangle -L RRDIPT_INPUT -vnxZ
+ iptables -t mangle -L RRDIPT_OUTPUT -vnxZ
+ iptables -t mangle -L RRDIPT_FORWARD -vnxZ
+ [ -n  ]
+ detectWAN
+ [ -n  ]
+ detectIF wan
+ which uci
+ uci=/sbin/uci
+ [ -n /sbin/uci -a -x /sbin/uci ]
+ /sbin/uci get network.wan.ifname
+ IF=eth0
+ [ 0 -eq 0 ]
+ echo eth0
+ return
+ wan=eth0
+ [ -n eth0 ]
+ echo eth0
+ return
+ wan=eth0
+ [ -n eth0 ]
+ readIF eth0
+ IF=eth0
+ grep  eth0  /tmp/traffic_INPUT_8948.tmp
+ read PKTS BYTES TARGET PROT OPT IFIN IFOUT SRC DST
+ [ INPUT = OUTPUT ]
+ [ INPUT = INPUT ]
+ [ eth0 = eth0 ]
+ IN=0
+ grep  eth0  /tmp/traffic_OUTPUT_8948.tmp
+ read PKTS BYTES TARGET PROT OPT IFIN IFOUT SRC DST
+ [ OUTPUT = OUTPUT ]
+ [ eth0 = eth0 ]
+ OUT=0
+ [ OUTPUT = INPUT ]
+ echo 0 0
+ IN_OUT=0 0
+ cut -d  -f1
+ echo 0 0
+ IN=0
+ echo 0 0
+ cut -d  -f2
+ OUT=0
+ [ 0 -gt 0 -o 0 -gt 0 ]
+ grep -vi ^IP\|0x0 /proc/net/arp
+ read IP _ _ MAC _ IFACE
+ IN=0
+ OUT=0
+ grep 192.168.0.1 /tmp/traffic_FORWARD_8948.tmp
+ read _ BYTES _ _ _ IFIN IFOUT SRC DST
+ [ 0.0.0.0/0 = 192.168.0.1 ]
+ [ 192.168.0.1 = 192.168.0.1 ]
+ OUT=0
+ read _ BYTES _ _ _ IFIN IFOUT SRC DST
+ [ 192.168.0.1 = 192.168.0.1 ]
+ IN=0
+ [ 0.0.0.0/0 = 192.168.0.1 ]
+ read _ BYTES _ _ _ IFIN IFOUT SRC DST
+ [ 0 -gt 0 -o 0 -gt 0 ]
+ read IP _ _ MAC _ IFACE
+ sed s/|$//
./wrtbwmon.sh: line 1: can't open /tmp/updated_8948.tmp: no such file
+ tr \n |
+ egrep -v /root/usage.db
pyrovski commented 9 years ago

It looks like there was no traffic counted. Can you check iptables manually with iptables -nvxL -t mangle? There should be a rule that counts traffic over eth0 at least.

pyrovski commented 9 years ago

No update; closing.