0

I've got a network of static file serving servers. I use nginx to serve the files, and munin to monitor the network traffic. I want to know the output bandwidth of the server that goes to each IP address downloading a file to evaluate the bandwidth each Internet Service Provider in my country is downloading from my servers. The average output bandwidth of servers is about 700MB/s (9 servers, most of them have 4 1Gbits/s ports bonded). How can I do this?

Sina
  • 11
  • 4
  • You've specified the software you're using, but the actual OS, a simple network diagram and a more specific definition on what data you need (like an example) would make it much easier to give an answer to your question. – Zip May 21 '20 at 18:32

2 Answers2

0

There is a tool on most repositories called iftop. It will display a graph and data about the bandwidth on each server. One way you can use it is like this:

# iftop -nNPi eno1 -f "port 443"
  • -n will disable name resolution for IPs
  • -N will disable port conversion to services
  • -P will show the ports used on the traffic
  • -i will select an interface to listen on
  • -f will define a bpf expression to filter traffic, which I defined as port 443 as a basic suggestion

You are not specifying where exactly you want to/can listen, or which traffic goes where nor which exact traffic you want, so this answer doesn't try to cover it. Also keep in mind that it may not work if you use zero copy or other "exotic" configurations.

Zip
  • 204
  • 1
  • 7
0

The first approach that comes to mind is to have your web servers simply log the requests they handle and use a log parser to generate usage statistics. The combined log format is a standard commonly supported by log parsing web analytics software.

access_log /path/to/log combined; 

If your web servers run as cluster rather than have each server maintain their own log files which you would need to merge to get aggregated results, you can use the syslog protocol to have all nodes transmit their log entries to a central logging host and generate usage statistics there.

access_log syslog:server=address combined;

The relevant settings are documented in the nginx manual.

This older question mentions some of the web analytics software, as does Wikipedia

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • Thanks for your answer. I can use $request_time to calculate the average download speed for any download request. But I need the output bandwidth of server at each moment. Something like what munin is doing for me. But with munin I dont have any control on IPs. – Sina Aug 16 '14 at 09:41