Closed captn3m0 closed 7 years ago
The /etc/init.d/wrtbwmon enable
command enables the wrtbwmon service to run every time the router boots. This basically means the wrtbwmon setup
command is run after every startup. This is the only thing needed by the update/publish
cycle to work properly.
The update/publish
cycle gets called every time you access the Usage
page in your router. This ensures that the graphs you will see are the latest ones. AFAIK wrtbwmon
uses iptables rules to track bandwidth so you shouldn't see any inaccurate data (whenever you run update
the db file used by wrtbwmon is updated to the latest total bandwidth usage).
You are probably right that a cron job would not have adverse effects; however it is not needed. The interval used in the UI is only needed by the speed columns.
I'm still going through the wrtbmon codebase, but still confused.
Where does wrtbmon persist the data between reboots? Wont the iptables
rules get reset on a reboot?
Ok, so looks like a reboot doesn't persist.
Yesterday (I had some data for sure):
Today:
I see now what you are trying to do. I don't think the cron job will be able to persist the data. This is because wrtbwmon setup
(and subsequently luci-wrtbwmon
) uses /tmp/usage.db
as the location of the database file. Everything under the /tmp
folder will be deleted after every reboot.
In my opinion the above is the correct way of handling data for your router. Storing a db file in any other place than the /tmp
directory can quickly fill the memory of your router (making it unresponsive).
However, I'm open to suggestions if you have something in your mind that can "solve" your problem, without adding installation overhead (i.e. tricky configuration steps).
usage.db
fie isn't actually that large. It takes one line per IP address, and depending on your address space it could be feasible to store it on the router. I have a very limiting router (2MB disk-space), and I can justify the usage.db
filesize (<1kB as of now).Maybe just having a configurable option on the location of the file. The usage.htm
can continue to stay on /tmp
.
I haven't setup a cron yet (as recommended), but I was wondering if the router goes down accidentally (say, on power loss) and I haven't checked the web-interface in a while, then the
update/publish
cycle won't get called.Which means that the graphs would be inaccurate on the next reboot.
I think the wrtbmon code already has a lockfile, so running
update/publish
on a cron shouldn't have any adverse affects either.