Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to gather some network statistic to test my server application. I've tried many linux tools, but nothing I've found suits my needs.

Basically I want to gather some UDP statistics (bytes/time_interval, packets/time_interval, packets_loss), but regarding only two particular hosts - for example I want to get UDP statistic from traffic going from IP_A:PORT_A to IP_B:PORT_B.

Tools like tcpdump/wireshark can easily dump such traffic but I have problems with getting statistics like temporary speed (too see throughput peeks), and linux system statistics gives me number for all traffic.

It would be better to get text output so it will be possible to parse it and put to gnuplot. I was able to get desired info from iptables, but parsing output from

iptables -L -v

seems quite difficult.

Anyone has any idea how can I achieve it?

Thanks in advance

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Use custom iptables rules:

iptables -I INPUT -p udp -s IP_A --sport PORT_A -d IP_B --dport PORT_B
iptables -I OUTPUT -p udp -s IP_B --sport PORT_B -d IP_A --dport PORT_A

And then poll it at regular intervals (every second? 5 seconds?) noting the changes and doing the appropriate calculations.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.