Page 5 of 6 FirstFirst ... 3456 LastLast
Results 61 to 75 of 90

Thread: Graphical IP accounting

  1. #61

    thx

    Thx Wizipok,
    I know this command, but I donīt know how to read each line sepately. I tried to use AWK but this command read all lines together. Maybe any option in this command?

    p.s. Jinak uz mam celkem slusne predelane ty skripty. Az to bude cele, ozvu se.

  2. #62

    huh

    I'm slowly giving up on this installation, so I thought maybe it's time I ask for your help.

    Everything works fine but the counting. I'm using Mark's v2 and the problem is:

    1) iptables doesn't count PC traffic
    Code:
    Chain traffic_in (1 references)
        pkts      bytes target     prot opt in     out     source               destination         
           0        0            all  --  eth0   any     anywhere             192.168.0.10       
           0        0            all  --  eth1   any     anywhere             192.168.0.10
    I was so desperate that I added both eth0 and eth1, but still nothing. It's the same with traffic_out. What should I check here?

    2) Router traffic is counted, but isn't transfered to the log files:
    iptables gives
    Code:
    Chain router_in (1 references)
        pkts      bytes target     prot opt in     out     source               destination         
        1109   146435            all  --  any    any     anywhere             anywhere
    and accounting script searches for
    Code:
    bytesin=`iptables -L router_in -vx | awk '$8 ~ /'"$WAN"'$/ {print $2 }'`
    $WAN which is not given in the iptables result. I know how to deal with thi problem but i'm confused why does it happen. I guess there must be a problem with iptables entries but I didn't modify anything. Could someone please help!
    Last edited by oversc0re; 09-11-2005 at 13:17.

  3. #63

    ETHx is dead!?!

    I just can't view ETH0 or ETH1 traffic. I created a test chain, inserted all interesting devices and attached it to FORWARD.

    Code:
    iptables -L itraffic -vx
    Chain itraffic (1 references)
        pkts      bytes target     prot opt in     out     source               destination         
        2154   235103            all  --  br0    any     anywhere             anywhere           
        1037   674518            all  --  any    br0     anywhere             anywhere           
        1583   729608            all  --  ppp0   any     anywhere             anywhere           
        1020   156826            all  --  any    ppp0    anywhere             anywhere           
           0        0            all  --  eth0   any     anywhere             anywhere           
           0        0            all  --  any    eth0    anywhere             anywhere           
           0        0            all  --  eth1   any     anywhere             anywhere           
           0        0            all  --  any    eth1    anywhere             anywhere
    ETH's are 0 all the time regardless of internal or external traffic. But when i check ifconfig ETH0 shows 400MB of Tx and 120MB of Rx traffic. Beats me
    Last edited by oversc0re; 10-11-2005 at 12:42. Reason: typo

  4. #64
    I'm having a monologue here... but maybe one day... I used ppp0 interface, and I got everything working now ... even the rrd graphs and stuff. But every now and then the iptables entries get deleted and the traffic isn't counted anymore. Looks like the router refreshes the entries and my custom ones get deleted. Is there a way to solve this without formating my USB flash to ext3?

    tnx for your answers.

  5. #65
    Join Date
    Jun 2004
    Location
    Delft, The Netherlands
    Posts
    62
    Had the same problem. Problem can be solved by putting iptables initialization script (add_iptables.sh) to the post-firewall script in /usr/local/sbin and activating with flashfs save / flashfs commit.

  6. #66
    Hey ... thanx for the answer ... I was just about to delete my post because I found that solution on the forum 5 mins ago
    This is a bit offtopic but anyway... I had to add the ip's manually to the post-firewall, because the usb flash device isn't mounted at the time. I also created post-mount script where I start httpd and init the rrd. The post-mount executes, but still too soon I can't use the USB flash for 2 or 3 minutes after the router wakes up. It is mounted but unreadable. Any ideas? (I really don't wanna format it to ext3)

    Log states:
    Code:
    Nov 16 11:42:41 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:42:41 kernel:  I/O error: dev 08:11, sector 2
    Nov 16 11:42:41 kernel: EXT3-fs: unable to read superblock
    Nov 16 11:42:41 kernel: MSDOS FS: Using codepage 950
    Nov 16 11:42:41 kernel: MSDOS FS: IO charset cp950
    Nov 16 11:43:11 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:43:11 kernel:  I/O error: dev 08:11, sector 0
    Nov 16 11:43:11 kernel: FAT: unable to read boot sector
    Nov 16 11:43:11 kernel: FAT: freeing iocharset=cp950
    Nov 16 11:43:41 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:43:41 kernel:  I/O error: dev 08:11, sector 0
    Nov 16 11:43:41 kernel: FAT: unable to read boot sector
    Nov 16 11:44:11 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:44:11 kernel:  I/O error: dev 08:11, sector 0
    Nov 16 11:44:11 kernel: NTFS: Reading super block failed
    Nov 16 11:44:41 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:44:41 kernel:  I/O error: dev 08:12, sector 2
    Nov 16 11:44:41 kernel: EXT3-fs: unable to read superblock
    Nov 16 11:44:41 kernel: MSDOS FS: Using codepage 950
    Nov 16 11:44:41 kernel: MSDOS FS: IO charset cp950
    Nov 16 11:45:11 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:45:11 kernel:  I/O error: dev 08:12, sector 0
    Nov 16 11:45:11 kernel: FAT: unable to read boot sector
    Nov 16 11:45:11 kernel: FAT: freeing iocharset=cp950
    Nov 16 11:45:41 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:45:41 kernel:  I/O error: dev 08:12, sector 0
    Nov 16 11:45:41 kernel: FAT: unable to read boot sector
    Nov 16 11:46:11 kernel: SCSI disk error : host 0 channel 0 id 0 lun 1 return code = 70000
    Nov 16 11:46:11 kernel:  I/O error: dev 08:12, sector 0
    Nov 16 11:46:11 kernel: NTFS: Reading super block failed
    Nov 16 11:46:11 kernel: VFS: Can't find ext3 filesystem on dev sd(8,20).
    Nov 16 11:46:11 kernel: MSDOS FS: Using codepage 950
    Nov 16 11:46:11 kernel: MSDOS FS: IO charset cp950
    Format does not help.

  7. #67

    HOWTO ready?

    YAEGER:
    Hi,
    I read in this thread that youīll gonna write a nice how-to on this installation - have you done something like that?

    Iīd be really interested - right now I have sucsessfully followed macsats tutorials on: ipkg, crond, thttpd

    Earlier I also had the macsat version of the RRDTool IP Accounting running.
    But with the limitation that it showed only the general traffic and not per IP address.

    Thanks for any further hints,
    greetings from austria,
    schim

  8. #68
    Well... I don't know about the howto, but if you read the whole thread and experiment a bit, you'll be able to get it working. If you get stuck somewhere, I can help. There are basically two different versions of the accounting described in this thread (none of them really worked for me, so I have written another combined from the two available). I can give you mine but it's totaly undocumented so maybe you should try a documented version first

    Greetings from over the border (Slovenia)

    over.

  9. #69

    Everything fine except the GIFs?

    Hi oversc0re,
    thanks for reply - I just tried the installation and it worked.

    Everything looks fine except the fact that I canīt find the GIFs!
    I found out that the plotping.sh file is missing - should this script generate the gifs?

    Please upload this script if itīs of any need.

    Thanks,
    schim

    EDIT: OK - I found it out myself: the orig. script plot_single.sh was written to send the gifs after creation via ftp to an external server and then DELETE the files in RAM - thatīs why I didnīt find them :-)
    Last edited by schim; 08-03-2006 at 17:35.

  10. #70

    Here's my version

    I don't know about the missing file in your version, i can just give you my files. As I've mentioned earlier this version is not compatible with any other version because it is mostly rewritten from scratch. I kept a few elements from other scripts (the web bar for total download with a totaly rewriten data feed) for which all the credits go to their authors.
    If you want to see what you are about to install, click here

    I have packed my whole /tmp/harddisk directory into the file attached. If you extract it back there, you shouldn't have problems with the paths.

    Installation:

    Extract zip to /tmp/harddisk

    Edit the /accounting/ipaddress.txt file and enter your addresses. Addresses that are not entered are monitored under total traffic, but do not get a separate trace.

    Edit /accounting/init.sh and check the ip's the ip prefix etc... Also check the paths which should be ok.

    Search through all the files and look for word oversc0re. Change it with your router username.

    Add iptables entries by running accounting/add_iptables.sh

    Run everything else by accounting/run.sh

    Now you have to wait for 10 minutes for first results. The results can be seen at http://router_ip:81/

    If you get the script working, you can run the nvram_install.sh and it will add itself to post-firewall and post-mount and will be started at the router startup.

    Note: in order to spare the USB stick (too frequent writes can damage the stick) the script copies all the vital data to ram and works from there. The data is backed up every night at 3:00 AM from ram back to usb stick. If you restart the router without running the ./backup.sh, the data from prevous backup until restart will be lost.
    The traffic graphs are created at real time (on request) so we don't use the CPU time when it's not needed and that's why it takes a while for the graphs to show.
    I'll stop now... If I missed something, just ask.

    Since my attachment is just over 1MB i have to put it to an external location
    Last edited by oversc0re; 08-03-2006 at 19:19.

  11. #71

    Thanks!!!!

    Hi again,
    impressive work! Thank you for the extra afford you made - I hope that other readers of this forum will also get a benefit from this.

    At the moment I made the first modifications on sodb version by myself and one of the first things I missed was the total up/download in numbers below the graphs.

    The other idea I had was: letīs just create the graphs if they are needed - because the routerīs CPU isnīt that fast.

    In the past I had problems when streaming video over WLAN with the router running www.macsat.comīs Version of the IP Accounting. It ran every 15mins and drew the graphs which almost took 2mins with 100% CPU load - during this 2 mins the streaming video was rahter stuttering. It took me a while until I realised that the IP Accounting tool was the reason for this ;-)

    Again many thanks - Iīll give your luxurous version a try and let you know what I think.

    greetings,
    schim

  12. #72
    Well, I hope you make it work. There's one more thing... In the colors.txt file there are colors for traces on the graphs. I think it is ok, if there are more colors than traces, just make sure that there are not less colors.

    Hope you like it.

    greetz, over.

  13. #73

    CGI question

    hi again,

    I took a closer look to your version and could learn much of it (I´m new to linux and web programming).

    I´d like to add one little gimmick to my version:

    a simple button or even a hyperlink in my html file which executes a .sh script when you click on it.

    After a lot of webresearch I´ll give up at this point. I don´t want to study this for too long - I just want generate the graphics when I click somewhere in the webinterface - shouldnt be to hard, or?

    My environment:
    using the thttpd webserver at port 81 with cgi directory - cgi should be the thing to exec .sh script or?
    Do I have to start thttpd webserver with some specific options in order to use cgi?


    thanks,
    schim
    Last edited by schim; 09-03-2006 at 19:00.

  14. #74
    You can put a simple hyperlink to a .cgi file and from .cgi file you run the .sh script. Good enough?

    Did you maybe try to install my version? Because I think I have forgotten to include some files needed for the web interface I have updated the file at original location. Now it contains a rrddata directory with web interface files included. Be sure to update the /accounting/init_rrd.sh because it is updated. Other files are left unchanged.

    greetz, over.
    Last edited by oversc0re; 09-03-2006 at 20:34.

  15. #75
    I just can't get it to gather and plot data for my users. Only router data...

    I'm running the router without any username/password on the ADSL.
    3 fixed users, 192.168.1.2 - 4

    Init.sh:

    #!/bin/sh
    #directory where accounting scripts reside
    rrddir=/tmp/harddisk/rrd
    # directory to store RRD database files
    datadir=/tmp/rrd
    # change these values depending on WAN connection
    wanint="eth0"
    LAN="192.168.1.1"
    #masked my ip...
    WAN="62.xx.214.55"

    #ipprefix consists of the first 3 number of your
    #LAN side ip addres.
    #
    ipprefix="192.168.1"
    # define mask that includes all PC's in LAN
    # e.g. addresses .2 .3 .4 .5 .6 fit within $ipprefix.0/29 mask.
    LANMask=255.255.255.0

    Ipaddress.txt:
    Sveinung 192.168.1.2
    Regin 192.168.1.3
    Ingunn 192.168.1.4

    Can anyone see any errors?

Page 5 of 6 FirstFirst ... 3456 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
  •