I have a question of my own. (Wanted to make it a separate post as it didnt have to do with the reply to the guy above. hope its cool)
I would like to add another line to the bottom of the table that shows total downloaded/uploaded in the course of the month. not just individual totals but overall totals.
If thats possible please let me know what to add or what.
Sorry for bump but would appreciate help. Edited above post, now that I have a better idea of how to use this thing.
I am by no means an expert myself as I am still fairly new to this but I have gotten this working.
1. Try naming it users.txt. thats what ive done and it works. dont know if theres something with maybe using the - in the filename or not. also make sure the users.txt file is in same folder as wrtbwmon.
2. as for changing sleep 9 to sleep 3 that wont make the page refresh in 3 seconds as opposed to 9, that is a delay between those commands in the script. from my understanding you dont want that to be too quick either or it wont work cause the reading might not have been fully done yet for it to write to the db file.
as for your last comment about the excessive writing, that is true as it will wear out the flash memory that is built into the router. i have mine set to back up every 2 hours, some might say that that is a bit too frequent but meh its better than the original like 15 seconds of Kodis script
In order to have the page refresh faster, look in wrtbwmon file and scroll down to where it says Create HTML Page and look close to the end of it where it has the refresh code. theres somewhere it says var seconds=11 id imagine change that to 3-4 and it should refresh faster. I havent tried it so if it doesnt work then just change it back.
Also for reference this is the startup script I am using.
I changed the name to users.txt, but still no names displayed; only MAC addresses. And yes, the file is in the same folder as wrtbwmon.
Do you think it has anything to do with the fact that (so it seems) everyone else is using the path /jffs? Or my path (/tmp/mnt/sda1) is fine the way it is?
as long as the path leads to the proper location of the files, it doesnt matter where they are.
so you have the DNSMasq options all on?
the users file is it in <MAC Address>,<Name> format? apparently some routers dont like the mac address to be in capital letters either. that could be the issue. also i believe no spaces between mac address and the comma and the name. the name can have spaces though and one entry per line.
as long as the path leads to the proper location of the files, it doesnt matter where they are.
so you have the DNSMasq options all on?
the users file is it in <MAC Address>,<Name> format? apparently some routers dont like the mac address to be in capital letters either. that could be the issue. also i believe no spaces between mac address and the comma and the name. the name can have spaces though and one entry per line.
I have DNSMasq, Local DNS, and No DNS Rebind all enabled; and the Additional DNSMasq Options, I entered:
domain=lan
local=/lan/
expand-hosts
I saw a post that said to add that in. I hope read it correctly, lol.
When trying to put all the MAC addresses in lowercase, then the page loads as an empty table. I guess I need the MAC addresses to be in capital. And yes, the form is correct. I'm supposed to keep the colons in the MAC address, correct? For example, it should look like:
obviously the addresses are blurred and hostnames are but i have set that up as well for another reason. not sure if it impacts the wrtbwmon. i found an app for my phone called wrtgate and it relies on that list to see the computers properly.
when you changed the mac addresses to lowercase and you say it loaded a blank table, did you give it a fair bit of time to read the file? also i find its best if you dont edit the file while on the router but rather edit it locally on your computer then copy it over to the router and overwrite it.
just side question, is there a reason youre using usb flash instead of jffs? does your router not support it? what router is this by chance? again im no expert but i am just curious.
obviously the addresses are blurred and hostnames are but i have set that up as well for another reason. not sure if it impacts the wrtbwmon. i found an app for my phone called wrtgate and it relies on that list to see the computers properly.
when you changed the mac addresses to lowercase and you say it loaded a blank table, did you give it a fair bit of time to read the file? also i find its best if you dont edit the file while on the router but rather edit it locally on your computer then copy it over to the router and overwrite it.
just side question, is there a reason youre using usb flash instead of jffs? does your router not support it? what router is this by chance? again im no expert but i am just curious.
I already had the first screenshot set up the same way, so I'm not going to upload that. The second link, it's not the same. Here it is:
First, I noticed that you set up "Used Domain" as "LAN & WLAN". When I tried that, web pages would not load on my computer. When I switched it back to just WAN, everything started working fine again. I'm not sure what the difference is but in order for me to web browse, I have to set it up "Used Domain" as "WAN".
Next, you entered all of the connections under "Static Leases", so I tried to put just one, my active computer that I'm using right now. I'm not sure what the point of it is for wrtbwmon, so I'm just leaving the one entry for now. I didn't see a difference anyway. Maybe you entered it solely because you have that wrtgate app? I didn't quite understand what you were saying because I've never used/heard of that app.
Oh, and yes, I did give an ample amount of time for the router to read/gather data after changing everything to lower case. As for your point about editing the file directly on the router, I have no idea how to do that. Every time, I pull the USB out of the router and put it back into my computer to make any edits. It's quite a hassle, but luckily my router isn't far away
Finally, I don't think the router supports jffs, or if it does, I have two reasons why I'm not: (a) I have no idea how to use/access it, and (b) I think I read on one of the posts in this thread that jffs wears out very quickly, or something along those lines.
EDIT: just uploaded the USB settings. I think it does support jffs, but like I said, I'm not sure how to use it. Do I just telnet, cd to /jffs and put all the files there?
My router is an Asus RT-N13U b1 running on DD-WRT v24-sp2 (07/24/13) build 22118.
To use the JFFS partition, you create it by turning it on in the settings and then when you log in to your router with filezilla or winscp or equivalent you will see a jffs folder there. just toss the files in there and then edit the startup script accordingly. make sure you do the wrtbwmon setup command from a telnet/ssh session logging in a root and the login password. then you should see a usage.html file in the /tmp/www/ folder and there should be a usage.db file in the /tmp/ folder. then if thats all ok then restart the router to make sure the startup script works.
As for the JFFS wearing out, it can wear out if you set the backup of the usage.db file from /tmp/ to /jffs/ at like 15 seconds or so. I have mine set to like 2 hours so it shouldnt be too bad.
About that WRTGate app, yeah that is partly the reason i set up the static leases is cause the app wouldnt see the names otherwise, only the MAC Addresses. That is also useful for setting up a pseudo-static IP for your LAN computers as well. In other words the devices can all "get IP automatically" but as the static leases are set up the router will assign that MAC Address that LAN IP every time. Its just a neater way of doing static IPs without setting them manually on every device.
To use the JFFS partition, you create it by turning it on in the settings and then when you log in to your router with filezilla or winscp or equivalent you will see a jffs folder there. just toss the files in there and then edit the startup script accordingly. make sure you do the wrtbwmon setup command from a telnet/ssh session logging in a root and the login password. then you should see a usage.html file in the /tmp/www/ folder and there should be a usage.db file in the /tmp/ folder. then if thats all ok then restart the router to make sure the startup script works.
As for the JFFS wearing out, it can wear out if you set the backup of the usage.db file from /tmp/ to /jffs/ at like 15 seconds or so. I have mine set to like 2 hours so it shouldnt be too bad.
About that WRTGate app, yeah that is partly the reason i set up the static leases is cause the app wouldnt see the names otherwise, only the MAC Addresses. That is also useful for setting up a pseudo-static IP for your LAN computers as well. In other words the devices can all "get IP automatically" but as the static leases are set up the router will assign that MAC Address that LAN IP every time. Its just a neater way of doing static IPs without setting them manually on every device.
I was about to go through the steps you posted, but then wanted to ask if it would make any difference. I mean, my only issue is that the MAC addresses display instead of the host name, and you said that as long as the path is correct, it shouldn't matter where the file is. I don't mind using the USB; I mean, it's super old anyway. However, if you think switching everything over to jffs will maybe work a little magic, then I'll go for it.
Im assuming youve updated this line with the correct users.txt filename since i remember you said youd changed it
/mnt/sda1/wrtbwmon publish /tmp/usage.db /tmp/usage.html /mnt/sda1/MAC-PCname.txt
I dont know really now. I had issues with this as well and it seemed to just magically start working. I do remember however that in the very beginning i did forget to actually run the setup but yet somehow the usage html file got created. probly due to a restart of the router. Id try the startup script commands one by one in putty and see if something changes. probly a restart after all of it as well.
Also make sure the appropriate files are marked as executable too.
Im assuming youve updated this line with the correct users.txt filename since i remember you said youd changed it
/mnt/sda1/wrtbwmon publish /tmp/usage.db /tmp/usage.html /mnt/sda1/MAC-PCname.txt
I dont know really now. I had issues with this as well and it seemed to just magically start working. I do remember however that in the very beginning i did forget to actually run the setup but yet somehow the usage html file got created. probly due to a restart of the router. Id try the startup script commands one by one in putty and see if something changes. probly a restart after all of it as well.
Also make sure the appropriate files are marked as executable too.
Hm. What exactly do you mean by "run the setup" and "marked as executable"? Perhaps my problem exists somewhere between these two. I thought the setup was being run at startup because the script is saved to startup in the Commands tab. And as for being marked as executable, do you mean that they aren't read-only files, or do I have to enter another command line? Something that sounds like chmod 700 or something like that.
also from putty enter the command:
/bin/sh /jffs/wrtbwmon setup
(of course your path will vary)
then check in the /tmp/www/ folder to make sure the usage.html file is there. if it is already there as a result of restarting, delete it then do setup again. then after the script is in the startup, restart.
How would I be able to reset the amounts under "Total" "Download" and "Upload"? I want to know which part to change so that if I wanted it to reset at the end of the day, or at the end of every hour, I'd be able to do so.
Just in case anyone is wondering, this does work on Atheros routers as well. I have this running on a Dlink DIR-825 C1 without a problem. I also had problems with the Mac to PC name mapping, the format that IS working for me is
6c:62:6d:1a:XX:XX,katy-pc,
So with the end comma. I also have my file called MAC-PCname.txt and its working.