ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

How CDM probe collects and calculate the network Inbound/Outbound data in Linux environment

book

Article ID: 227550

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

How CDM probe collects and calculate the network Inbound/Outbound data in Linux environment

Environment

Release : 20.3

Component : UIM - CDM WITH IOSTAT (any version)

Resolution

To get the list of interface names:


Command: 
sar -n DEV | grep 'Average:' |awk '{ print $2}' | grep -vwE 'lo'

 

To read the total number of bytes per second transmitted and received by the server

Command: 

sar -n DEV | grep 'Average:' |awk '{ print $2,$5,$6 }'

The transmitted and received rates are calculated by doing the sum of all interfaces transmitted (txRate) data and all interfaces received (rxRate) data.

Lets say, the output of the command is as below:

eth0 0.35 0.15
virbr0-nic 0.00 0.00
virbr0 0.00 0.00

Then the Received, Transmitted and Total rates will be as below:

NICRxRate = (0.35 + 0.00 + 0.00)
NICTxRate = (0.15 + 0.00 + 0.00)
NICTotalRate = (NICRxRate + NICTxRate)

 

And then finally converts into bytes

Inbound Traffic = NICRxRate * 1024

Outbound Traffic = NICTxRate * 1024

Aggregated Traffic = NICTotalRate * 1024

 

Utilization Statistics:


To get the Network interface speed.


Command: 


ethtool <interface_name> | grep 'Speed' | awk '{ print $2 }'


Example: 
ethtool virbr0-nic | grep 'Speed' | awk '{ print $2 }'
Then convert from megabytes to bits.


Example: 
speed_in_mb = 10 mb/s
speed_in_bits = (speed_in_mb * 1024 * 1024)

Then take the differences of transmitted and received rates between two intervals:


rxRate = (current received rate - previous received rate)
txRate = (current transmitted rate - previous transmitted rate)

Take the time difference between two intervals:


sample_time = (current interval time - previous interval time)
Multiply the time and speed:
bandwidth = (sample_time * speed_in_bits)

Final formula is used for Utilization Statistics.


Inbound Utilization = (rxRate * 8 * 100)/bandwidth
Outbound Utilization = (txRate * 8 * 100)/bandwidth