Results 1 to 15 of 90

Thread: Graphical IP accounting

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Join Date
    Jun 2004
    Location
    Delft, The Netherlands
    Posts
    62

    RRD-based graphical IP accounting

    Probably the same as KAMILEK produced, here are my scripts.

    Using the older scripts of my earlier html-based graphical IP accounting, together with the improvements Mark Koops made, and with the HTML layout found at http://<br /> http://www.home.karne...0603501/zdenek I constructed some scripts to do graphical IP accounting using RRDtools.
    Installation of RRDtools are discussed earlier in this topic. I include my own compiled version in the tar ball.

    I use the following method: iptables collects traffic in up/down directions for individual PC's in LAN. Ifconfig is used for counting bytes transfered over the wan interface. Because of the frequent updates of counters (e.g. every 5 min), the RRD files are stored in RAM (/tmp/rrd). USB flash would wear out quite soon (10000 cycles are reached in 34 Months). Graphs are generates every single hour and also stored in RAM. Then, and that is a step that you might want to change, the graphs are uploaded to an external web server using ncftpput util (also included).

    To initalize the logging proces you have to do the following: 1) edit ipaddress.txt file to meet your requirements, 2) edit init.sh to change $wanint WAN port and lanmask, and directories, 3) add admin entries to crontab and see to it that crond is executed from post-boot. 4) execute add_iptables.sh (can also be put in post-boot), 5) initalise RRD's (might not be necessary of stored on HD or USB flash, 6) initiate HTML files and copy all *.html files to path or server served by webserver.

    The following files are included (untar with tar -xzvf rrd_iptables_tar.tgz, and then again tar -xvf rrd_iptables.tar) (edit) added correctversion of update_traf.sh:

    ipaddress.txt

    A two column file with the PC name and the PC address for the PC's to be minitored in the LAN

    init.sh

    Used for setting pathes, WAN port, LAN subnet and a mask that defines all the PC's addresses in the LAN, used with negation for determining 'other' traffic. See earlier in Mark Koops' description.

    add_iptables.sh

    Generates the correct entries in iptables based on ipaddress.txt file.
    gen_html.sh, gen_menu_html.awk, gen_graph_html.awk
    Generates menu.html, and the individual html code for each of the entries in the menu.

    footer.html, title.html, traf.html

    HTML templates for traffic page.

    init_traf.sh

    Generates initial Round Robin Databases for each of the entries in ipaddress.txt and other, $wanint and router entries.

    admin

    Example crontab file. To be copied in /var/spool/cron/crontabs.

    update_traf.sh (use seperate file)

    Script used to update counters of iptables entries in the specific RRD database. Is called from crontab.

    plot_traf.sh, plot_single.sh

    Script called from crontab to generate png graphic files from rrd databases.

    Hope this helps you installing the scripts. It is not very fancy, so you should adopt things to your personal needs.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by sodb; 28-09-2005 at 21:42.

Posting Permissions

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