Hi,
for me the Mark's script starts to calculate when I changed the ETH1 to ETH0 inside add_iptables.sh script, just try it ...
But I couldnot discover why the ROUTER and OTHER strings not contains any traffic
WiZiPoK
Well 24 is just another way of saying 255.255.255.0 (32 bits where the 24 first are 1 others are 0) so 28 would translate to 255.255.255.255.240 which means only the 16 first adresses are valid..
You should propably just set it to 24.
B
Hi,
for me the Mark's script starts to calculate when I changed the ETH1 to ETH0 inside add_iptables.sh script, just try it ...
But I couldnot discover why the ROUTER and OTHER strings not contains any traffic
WiZiPoK
I have the same problem :-(Originally Posted by WiziPok
Its still not working. dat files are created but they contain value 0 only :
Could someone post the files "add_iptables.sh" and "init.sh" forWL500gx from a installation that is logging traffic please?Code:06/06/05 23:00 out in 06/06/05 23:13 out in
Thank you so much.
Thomas
Hi, here is my init.sh script
at ADD_IPTABLES everywhere were is ETH1 I changed to ETH0Code:#directory where accounting scripts reside accountdir=/opt/accounting datadir=/opt/accounting/data #pointer to AWK applet AWK="awk" LAN="192.168.1.0" WAN="192.168.0.2" #ipprefix consists of the first 3 number of your #LAN side ip addres. Together with a 4th number in the #range lowerip to upperip, it makes the range of ip addresses #to be monitored in your LAN. # #warning: upperip relates to LANMask as: #ipprefix.upperip is the highest address that fits in ipprefix.0/LANMask ipprefix="192.168.1" let lowerip=9 let upperip=12 LANMask=28 minute=`date +"%M"` hour=`date +"%H"` year=`date +"%Y"` month=`date +"%m"` day=`date +"%d"` yday=$day
....but it is unbelievable, TODAY 08.june at 00:00 my INIT SCRIPT stop with ERROR. I dont understand why ... When I set the DATE back to 07.june 23:50 the INIT.SH script run without error, after mindnight stopd with failure.
the WRONG SINTAX WAS :
after removing "LET" and "-1" everything is working OK .... but the :"yesterday" day doesn.t set correctlyCode:yday=$day-1
and everything is runnig FASTER.
I realy don't understand this DATE issue (
WiZiPoK
Last edited by WiziPok; 08-06-2005 at 07:39.
to wizipok: and why did you change eht1 to eth0?
just to start to countOriginally Posted by kamilek
I solved the probs around the OTHERS and ROUTER counting ... There was a differenet string compare inside the "iptables -L -vx" and account_traffic.sh
There was enough to change the sring to "anywhere"
WiZIPoK
A while ago I did some fiddeling with these scripts my self and made them work ok. But in the end I made a new, easier and better solution that worked for me. Basically I just calculate usage each our and then upload the data to a web server I have runnig with a php script that stores the values in a mysql db. Then I have a php page there that shows my statistics. But for those who doesn't have a php server lying around that might not work.
But anyways, I said I made the Gr. accountings scripts kinda work before I made my own so I figured I could post them here. You can have a look, but I can't give you any garanties that they'll work for you, as I did a bit of tinkering with them..
The important files to look at and adapt are:
init.sh, ipaddresses.txt, mkcron, root
And the ones that does the work are:
add-iptables, and account_traffic.sh
Maybe it'll be a help to someone..
B.
So what do I have to change in account_traffic.sh?Originally Posted by WiziPok
So the line "let yday=$day-1" does problem only 8. and 9. day in each month. The other days are OK. Rewriting it to "yday=$day" is not solution because of problems with history data. What to do with it?
ah simple arithmetic like that doesn'e work in shell script.
try:
$yday=`expr $day - 1`
And take a look at a scripting tutorial:
ex: http://www.freeos.com/guides/lsst/ch02sec07.html
Hi Barsju,
yes, I used very close script to yours. In some scripts on 500gx I have to replace $WAN with the realy IP with numbers .. After is Everything start to work ...
What kind of improvement did you done in your script?
The one think what is very strange, inside the code (init.sh)
the last rows " let yday=$day-1 " doesnot work ..... or its works DEPENDING ON ACTUAL DATE .....Code:minute=`date +"%M"` hour=`date +"%H"` year=`date +"%Y"` month=`date +"%m"` day=`date +"%d"` let yday=$day-1
As KAMILEK wrote, doesnot wor on 8th and 9th day in month Why?
WiZiPoK
You are RIGHT !Originally Posted by barsju
yes, the expression :
inside init.sh works fine ..Code:yday=`expr $day - 1`
WiZiPoK
Oh. You don't really need those, and I guess I should not have included them. The current hour is to show traffic for current hour. (Normally you only calculate traffic for completed hours.) But I'll include the traffic_curr.cgi for completeness.Originally Posted by Kasio
As for the crontab, it is in the root file. Take a look there. And mkcron..
S.
Any way that you can make this public ?Originally Posted by barsju
Maybe the empty sql db and the needed php ?
Regards