Page 2 of 6 FirstFirst 1234 ... LastLast
Results 16 to 30 of 90

Thread: Graphical IP accounting

  1. #16
    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

  2. #17
    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

  3. #18
    Quote Originally Posted by WiziPok

    But I couldnot discover why the ROUTER and OTHER strings not contains any traffic

    WiZiPoK
    I have the same problem :-(

  4. #19
    Join Date
    Jun 2005
    Location
    Karlsruhe, Germany
    Posts
    44

    Question



    Its still not working. dat files are created but they contain value 0 only :
    Code:
    06/06/05 23:00 out  in 
    06/06/05 23:13 out  in
    Could someone post the files "add_iptables.sh" and "init.sh" forWL500gx from a installation that is logging traffic please?

    Thank you so much.

    Thomas

  5. #20
    Hi, here is my init.sh script
    Code:
    #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
    at ADD_IPTABLES everywhere were is ETH1 I changed to ETH0

    ....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 :
    Code:
    yday=$day-1
    after removing "LET" and "-1" everything is working OK .... but the :"yesterday" day doesn.t set correctly
    and everything is runnig FASTER.

    I realy don't understand this DATE issue (

    WiZiPoK
    Last edited by WiziPok; 08-06-2005 at 08:39.

  6. #21

    eth1 vs. eth0

    to wizipok: and why did you change eht1 to eth0?

  7. #22
    Quote Originally Posted by kamilek
    to wizipok: and why did you change eht1 to eth0?
    just to start to count

    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

  8. #23
    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.
    Attached Files Attached Files

  9. #24

    ?

    Quote Originally Posted by WiziPok
    just to start to count

    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
    So what do I have to change in account_traffic.sh?

  10. #25

    Angry

    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?

  11. #26
    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

  12. #27
    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)
    Code:
    minute=`date +"%M"`
    hour=`date +"%H"`
    year=`date +"%Y"`
    month=`date +"%m"`
    day=`date +"%d"`
    let yday=$day-1
    the last rows " let yday=$day-1 " doesnot work ..... or its works DEPENDING ON ACTUAL DATE .....
    As KAMILEK wrote, doesnot wor on 8th and 9th day in month Why?

    WiZiPoK

  13. #28
    Quote Originally Posted by barsju
    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
    You are RIGHT !
    yes, the expression :
    Code:
    yday=`expr $day - 1`
    inside init.sh works fine ..

    WiZiPoK

  14. #29
    Quote Originally Posted by Kasio
    In your scripts in /www is absent file traffic_curr.cgi.
    J don´t know, when I can run script account_traffic_bckup.sh, account_traffic_current_hour.sh.
    What is your crontabs file look like?

    Can you send me full script?
    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.

    As for the crontab, it is in the root file. Take a look there. And mkcron..

    S.
    Attached Files Attached Files

  15. #30
    Quote Originally Posted by barsju
    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.
    Any way that you can make this public ?

    Maybe the empty sql db and the needed php ?

    Regards

Page 2 of 6 FirstFirst 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •