LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   calculate traffic using iptables (https://www.linuxquestions.org/questions/linux-software-2/calculate-traffic-using-iptables-34239/)

p_nanda2002 10-31-2002 05:06 AM

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.

notsoevil 10-31-2002 08:57 AM

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

http://www.mrtg.org

p_nanda2002 11-01-2002 12:01 AM

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.

Mik 11-01-2002 02:31 AM

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.

p_nanda2002 11-01-2002 02:51 AM

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.


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