4

So I have created a Linux resource monitoring tool that pulls various resource information. One of the fields I am trying to pull is the percent of network throughput on my NIC. So if I have a 1 Gb(bit) NIC with 200 Mb(bit) being processed every second, the tool would display 20%. Basic calculations are below as an example.

sar -n DEV 1 1 #Used to pull Rx and Tx KB(byte) per second.

From here lets say it reports a total of 17000 KB(bytes). I then need to convert this to Kb(bits). So I would do the following.

17000 * 8

This gives me a total of 136000 Kb(bits). I need to turn this into Mb(bits) to get a percentage from my actual NIC speed.

136000 / 1000

I divide by 1000 to change this into Mb(bits). Total is now 136 Mb. From here I need to get a percentage based on my NIC. I have a 1Gb(bit) NIC.

136 / 1000 (NIC speed in Mb) * 100

This equals 13.6%

So a rough calculation would tell me that my NIC is processing 13.6% of what it is said to be able to process by the vendor.

My questions are below. If this is the wrong site, please forward me on as this is part networking, part math, and part Linux/OS reporting so I wasn't sure what to use. Thank you

  1. Is my reasoning flawed? For example, is my math correct on how I retrieve my percentage
  2. Obviously I would never get to 100% (theoretical), but wouldn't this information be useful for spotting a potential chokepoint in the network?
  3. What are the Pro's and Con's of displaying this information in my tool? I have heard people say this is pointless and error prone, but I have never understood their reasoning.
1
  • 1
    Ideally you'd use an average over a longer period of time, as instantaneous values are not a good indicator of current load. I.E the values from sar -n DEV 1 5 Feb 5, 2016 at 1:22

1 Answer 1

2

As fruglemonkey said 1 sec is a bad choice. Try at least 5 sec mean. It will help to have more consistent graph. Of course you can show both data ;-)

I can't see anything wrong on your math. But I suggest you to track number of packet/s too. This metric is a lot of important to understand problems. Is not rare you have pps limit reached with low traffic on Internet links (ddos e.g.).

Bandwith is a good metric to look too. I like to see this graph on my monitoring. I can't see bad side to show it to network admin.

1
  • I chose the one second pull as I have other calculations (cpu, memory, disk IO) that run at the same time and pull every second as well. I use GNUPLOT to then pull from a list of log files and graph the data over extended time. GNUPLOT does a good job of taking all the data and showing it as an average (at least I believe so). Hmm, I guess I could turn the time into a variable and let the administrator choose. Good idea on the packets. Thank you for the input.
    – IT_User
    Feb 5, 2016 at 16:04

Not the answer you're looking for? Browse other questions tagged .