LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 05: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, 08: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, 12: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, 02: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 02:43 AM.
 
Old 11-01-2002, 02: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



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-21-2005 11:39 PM
calculate (in & out) traffic shahg_shahg Linux - Networking 1 01-17-2005 08:02 AM
Calculate Interface Traffic JJX Linux - Networking 7 10-22-2004 02:38 AM
IPTABLES and PPTP Traffic pssst_yeah_you Linux - Security 2 07-27-2004 05:31 PM
parsing mail.log with perl and calculate mail traffic on domain base markus1982 Programming 1 03-18-2003 06:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:16 AM.

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
Open Source Consulting | Domain Registration