Last active
August 29, 2017 10:43
-
-
Save braian87b/be21ce36fc808658893d to your computer and use it in GitHub Desktop.
Instructions to get properly working wrtbwmon from https://github.com/pyrovski/wrtbwmon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions to get properly working wrtbwmon from https://github.com/pyrovski/wrtbwmon | |
# More info on: https://wiki.openwrt.org/doc/howto/wrtbwmon | |
# Remove previous package if present | |
root@OpenWrt:~# opkg remove wrtbwmon | |
root@OpenWrt:~# cd /tmp | |
# Download (search for latest ipk url on https://github.com/pyrovski/wrtbwmon/releases/) | |
root@OpenWrt:/tmp# wget https://github.com/pyrovski/wrtbwmon/releases/download/0.32/wrtbwmon_0.32_all.ipk | |
Connecting to github.com (192.30.252.131:443) | |
Connecting to github-cloud.s3.amazonaws.com (54.231.9.169:443) | |
wrtbwmon_0.32_all.ip 100% |*******************************| 5492 0:00:00 ETA | |
# Install ipk | |
root@OpenWrt:/tmp# opkg install wrtbwmon_*_all.ipk | |
Installing wrtbwmon (0.3) to root... | |
Configuring wrtbwmon. | |
# Remove ipk (as it is on /tmp will be deleted on reboot) | |
root@OpenWrt:/tmp# rm wrtbwmon_*_all.ipk | |
root@OpenWrt:/tmp# cd | |
# Replace wrtbwmon.sh with a newer version | |
root@OpenWrt:~# wget -O /usr/sbin/wrtbwmon.sh https://raw.githubusercontent.com/pyrovski/wrtbwmon/e537933f3f95061d40794995f6a6d27c5e7ed103/wrtbwmon.sh | |
# Clean previous data | |
root@OpenWrt:~# wrtbwmon.sh remove; rm -f /tmp/usage.db | |
# Configure | |
root@OpenWrt:~# wrtbwmon.sh setup /tmp/usage.db | |
# Manually test if is working: | |
root@OpenWrt:~# wrtbwmon.sh update /tmp/usage.db | |
root@OpenWrt:~# wrtbwmon.sh publish /tmp/usage.db /tmp/usage.htm | |
# Create a link to be able to browse using luci's httpd | |
root@OpenWrt:~# ln -s /tmp/usage.htm /www/usage.htm | |
# Add to Cron, every 1min (no problem since we are working with ram in /tmp) | |
root@OpenWrt:~# cat<<'EOF' >> /etc/crontabs/root | |
PATH=/usr/bin:/usr/sbin:/bin:/sbin | |
* * * * * /usr/sbin/wrtbwmon.sh update /tmp/usage.db | |
*/1 * * * * /usr/sbin/wrtbwmon.sh publish /tmp/usage.db /tmp/usage.htm | |
EOF | |
# Mark crontab as updated | |
root@OpenWrt:~# cat<<'EOF' > /etc/crontabs/cron.update | |
root | |
EOF | |
# Enable Cron and start/restart Cron | |
root@OpenWrt:~# /etc/init.d/cron enable | |
root@OpenWrt:~# /etc/init.d/cron start | |
root@OpenWrt:~# /etc/init.d/cron restart | |
# Navigate to usage page (or use a web browser) | |
root@Debian:~# lynx http://192.168.1.1/usage.htm | |
# BONUS: upadte every 5 seconds (to be ran manually ONLY): | |
cat<<'EOF' > every-5-seconds.sh | |
#!/bin/sh | |
PATH=/usr/bin:/usr/sbin:/bin:/sbin | |
while true | |
do | |
/usr/sbin/wrtbwmon.sh update /tmp/usage.db | |
/usr/sbin/wrtbwmon.sh publish /tmp/usage.db /tmp/usage.htm | |
sleep 5 | |
done | |
EOF | |
chmod +x every-5-seconds.sh | |
./every-5-seconds.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi there and thank you very much for this. I am quit new in the skript field and facing one issue i cannot solve
awk ip6tables-save odhcpd-update ubinize
brctl iptables opkg-key ubirename
chroot iptables-restore pppd ubirmvol
crond iptables-save readDB.awk ubirsvol
dnsmasq iw rmmod ubiupdatevol
dropbear lsmod ubiattach uhttpd
fw_printenv modinfo ubiblock wpa_supplicant
fw_setenv modprobe ubicrc32 wpad
hostapd ntpd ubidetach wrtbwmon.sh
insmod ntpd-hotplug ubiformat xtables-multi
ip6tables odhcp6c ubimkvol
ip6tables-restore odhcpd ubinfo
root@LEDE:/usr/sbin# wrtbwmon.sh setup /tmp/usage.db
Warning: using existing /tmp/usage.db
awk: /usr/sbin/readDB.awk:7: Unexpected token
root@LEDE:/usr/sbin#
Does anybody have an idea how to solve this issue? I am very desperate have been trying it for several days now. Replies very much appreciated.