Soft-haus.com’s new Wiki – IPTables Bandwidth Monitor for starters
The home for all documentation related to the IPTables bandwidth monitor project is now located here. This should be a useful resource for all users wanting to know about how to install, configure and use this useful tool.
I am trying to use your IPTables Bandwidth Monitor on our MWR network here in Afghanistan. I am using Tomato RAF 1.23.8515. I can’t get it to work using either method in the Wiki. When I use the “Logfiles Configuration Installation” it creates the logfile and updates it, but it contains no usage data and no IPs. When I use the other method I get a read error when I browse to /ext/. Any ideas? Maybe it doesn’t work with the RAF mod.
Are you able to telnet to the router and confirm that ipt-prase can execute from on the router?
cd /cifs1
./ipt-parse
does it output anything? Did you remember to:
chmod 777 ipt-parse
from a telnet session on the router itself in the folder that ipt-parse is accessible?
I can’t get the SetupUI to come up. I’m using your Type I configuration, does this require Type II?
What setup UI are you talking about?
hi
i have your ipt-parse and it sends out a file but no bandwidth data is in it
“Bandwidth usage v1.3.2 from: 0 to 0 – last update: 2009-12-19 11:59:01
Host Download Upload Total
Total 0.00 MB 0.00 MB 0.00 MB”
have telneted into and it shows the same out put as the html file!
i am using tamato ver 1.27 perhaps thats is the problem ??
thanks
bob
Ok, if you’re getting an empty table it means you either don’t have IP Addresses setup in the static list in tomato or you didn’t add the IP Addresses to the iptables watch list via the command:
./ipt-parse 6
Check the wiki again and make sure you have setup the static dhcp, the Scripts and the Scheduler all according to the instructions there. If you find the wiki hard to follow or understand I will see if I can edit its contents to make it more easy to follow with more detailed instructions.
hi again
have checked all thew setup as it says.
when i ./ipt-parse 1 from telnet into router i get
In [GetDayIndex] Invalid date(s) specified szCurrent [0]:Success
get 16 line like above .
lines 6,7 have [1],[10]
as do lines 14,15 [1],[10]
is that what should be ?
thanks
bob
No that isn’t right. From the shell run the following command:
iptables -L -vnx
Do you see anywhere some data related to your static IP’s as configured in Tomato’s static DHCP screen? If yes, try the command:
iptables -L ipt-parse-traffic-all -vnx
This should output stats for each IP configured in Tomato’s static DHCP screen and is what ipt-parse uses. To check to see what ips-parse has stored in its database for today run:
./ipt-parse 3 today today BANDWIDTH
You should see something like:
ipt-parse
Copyright (C) 2009 Mark Vejvoda
Using filter date-range [20091219] – [20091219]
Selecting SQL [SELECT host,sum(in_mb),sum(out_mb), sum(in_mb) + sum(out_mb) FROM bandwidthusage WHERE date(log_datetime) BETWEEN date('2009-12-19') AND date('2009-12-19') GROUP BY host;]
=====================================================================================================
Bandwidth usage v1.3.2 from: 20091219 to 20091219 – last update: 2009-12-19 21:47:56
Totals for host [192.168.0.101] Incoming [0.00 MB] Outgoing [0.00 MB] Total [0.00 MB]
Totals for host [192.168.0.107] Incoming [158.23 MB] Outgoing [9.84 MB] Total [168.07 MB]
Thanks
hi the command
iptables -L ipt-parse-traffic-all -vnx
results in
iptables No chain/target/match by that name
thanks
bob
hi forgot this
when i run the BANDWIDTH command i get
SQL:error no such table: BANDWIDTHUSAGE
bob
hi
thanks much for your help!
it h3lped me understand the way this SQL was to work!
for some reason the /cifs1/usagelogs dir was not created .
so i created it and now bandwidth is working fine !!
thanks very much for this program and your nice help !!
Merry Christmas to you and yours
bob
Hi Mark,
Thanks for a great project! I was able to get this up and running on Tomato last night using the sqlite method. My HTML files are being propogated properly and the bandwidth values seem accurate.
However, I have two problems, one more immediate than the other.
1. I’m unable to get the GUI working. I’ve ensured proper permissions and have the ‘tomato_dynamic…’ folder in my cifs1 share along with the UI script. When I go to MyRouter/ext the Soft-haus wrapper header appears, but the GUI is just the same with no added bandwidth by IP tabs or options. Unfortunately I’m very new to computer coding to be able to help myself. I checked some of the files and it appears that one module was trying to read JFFS for the BANDWWIDTH data. I tried changing this to cifs1, but now nothing works and I get a read error instead.
2. Ideally, I’d really like to have features similar to the way that Tomato already handles data compaction.
- Every hour for the past 24 hours
- Every day for the past week
- Every week for the past month
- Every month for the past year
However, I can’t figure out how to use ipt-parse to generate HTML files like this. My initial effort added ‘currentmonthlivebandwidth.html’ to summarize from the 8th of the month (billing cycle) to ‘today’. How to I create one that will measure last month? Further, how would I create an array that showed each IP within each month for all twelve months of the past year?
Thanks for any help you can offer, and thanks again for creating this!
BTW Tomato v.1.27
Mark, thank you for taking the time to put the IPTables bandwidth monitor project up on your blog. It’s a great addition to tomato.
I can’t seem to get the tomato shell wrapper to work with a secure web page though.
e.g.
I am getting a “500 Unknown, Read error” when using https. Any suggestions?
What are your Tomato settings (related to http) and what version of Tomato are you running? Do other https urls work?
I have tomato set to http & https (ports 80,443) in the Tomato “local web admin” menu. And I am using Tomato v1.28.9049 (Teddy Bear MIPSR2-beta19 K26 USB vpn3.6).
Other https urls work fine. Since posting, I’ve found a work around to this problem. If I change the tomato settings to http only and refresh the shell wrapper pages, then the https wrapper page will work. Even if I subsequently change it back to http & https (or https only). But for some reason Tomato needs to be briefly set to http only after any router reboot or the wrapper https page remains inaccessible. But no problems with any other https url. If you have any insight into this that might lead me to a proper fix, it would be appreciated.