Traffic accounting system for Slackware
Hello!
I've been looking for a traffic accounting system (for Slackware 11) for a certain amount of time. I originally needed a hour/day/week/year statistics sorted by a certain ipranges (for a different iptable chains). Now I made my own system on bash scripts+bc+crond+iptables. I've decided to post it here - I just hope someone will need it and will find it useful. I'd like to hear some comments/complaints/hints for optimizations/questions. So, here it is: System consists of three scripts. rc.firewall, /usr/lib/vsi-traf/traffic.sh /usr/lib/vsi-traf/iptable.pl (modified version, copyrights are intact). I also wrote some documentation, it's also here. (To use script, You'll need bc) Here they are: rc.firewall Code:
#!/bin/sh Code:
#!/bin/sh Code:
#!/usr/bin/perl Quote:
rc.local_shutdown: Quote:
Quote:
Code:
# If you don't want the output of a cron job mailed to you, you have to direct EDIT: real email addresses removed (due to spam). All files are available at http://shtraf.sourceforge.net or http://sourceforge.net/projects/shtraf along with contact information and newer files. Project will be most likely abandoned in the future. |
Very clever!
What a handy little piece of script. I'm going to run it and have a closer look when i get back to base. If you wouldn't mind i might try a simple front end to tie in with it? Brilliant idea though, your a true pioneer!
Lead the way captain erV! EDIT: how long did you spend on it? |
Quote:
Quote:
Quote:
Oh, and I almost forgot (it's probably obvious, but just in case). rc.firewall here is tuned for my personal needs, it blocks almost everything, and is just for reference/example how to do it (it splits traffic in several streams and make it flow through several different counters). To make another system/tune it for personal needs, someone will have to modify it rc.firewall. If someone will need explanation how it works, I'll write it. P.S. Maybe(can't promise) I'll make some C++ program with same functionality later (if I will have time for this). I would be good (but certainly not neccesarry) to put data in a database instead of files - since small files takes some amount of hard-drive space (which is bigger than file), or add some report-generator, etc... But I think that script is better, since it is easily readble, it is easy to change, etc. |
All times are GMT -5. The time now is 09:01 PM. |