LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2002, 06:06 AM   #1
p_nanda2002
LQ Newbie
 
Registered: Oct 2001
Location: chennai,india
Distribution: mandrake 8.0
Posts: 6

Rep: Reputation: 0
calculate traffic using iptables


Hello,

I am using Redhat6.2 box. I rewrote one perl utility which uses iptables to calculate the traffic by each ip on the linux machine. I used this command

/sbin/iptables -L -n -v -x


In the program i use some calculations for getting the traffic for current day which is logged into the database table as the total no of bytes for the current month. Eveything was working perfectly until the iptables gave one problem. The no of bytes was reset and started over again. Does any body know when the reset (i.e the upper limit of the traffic no of bytes) will occur.


Thanks.
 
Old 10-31-2002, 09:57 AM   #2
notsoevil
Member
 
Registered: May 2001
Location: Louisville, Kentucky, USA
Distribution: RedHat ES
Posts: 120

Rep: Reputation: 15
Instead of rolling your own solution, maybe MRTG can help you -- and with more options.

http://www.mrtg.org
 
Old 11-01-2002, 01:01 AM   #3
p_nanda2002
LQ Newbie
 
Registered: Oct 2001
Location: chennai,india
Distribution: mandrake 8.0
Posts: 6

Original Poster
Rep: Reputation: 0
Hello,

What exactly i need is the number of bytes used per month which is a number. The MRTG software gives graphs,stats and not a pure number. How can i get the no of bytes from MRTG?

Thanks.
 
Old 11-01-2002, 03:31 AM   #4
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well I don't think iptables is the one that resets the number of bytes. The information is probably retreived from /proc/net/dev. I don't know what the largest value is, you would probably have to browse through the kernel code to find out what sets and resets this value.

I think it's an unsigned long (4 bytes) which would allow it to go up to 4GB's.

Last edited by Mik; 11-01-2002 at 03:43 AM.
 
Old 11-01-2002, 03:51 AM   #5
p_nanda2002
LQ Newbie
 
Registered: Oct 2001
Location: chennai,india
Distribution: mandrake 8.0
Posts: 6

Original Poster
Rep: Reputation: 0
I got info that by issuing 'iptables -Z' will zero all the bytes and packets that was formed. I am using that to resolve my issue.

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Traffic-shaping with iptables Quantum0726 Linux - Networking 7 08-22-2005 12:39 AM
calculate (in & out) traffic shahg_shahg Linux - Networking 1 01-17-2005 09:02 AM
Calculate Interface Traffic JJX Linux - Networking 7 10-22-2004 03:38 AM
IPTABLES and PPTP Traffic pssst_yeah_you Linux - Security 2 07-27-2004 06:31 PM
parsing mail.log with perl and calculate mail traffic on domain base markus1982 Programming 1 03-18-2003 07:22 AM


All times are GMT -5. The time now is 10:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration