• 3

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I would like to validate a certain thought with you guys. Assuming that:

  1. The device whose bandwidth I am measuring is an internal, Linux-based, router.
  2. If a NIC is configured to 100mbps, the network is at least 100mbps (that is, the NIC's speed setting it what is limiting the bandwidth, not the network, its latency, etc.)
  3. Elements such as CPU have no impact on bandwidth.

Would it be correct to:

  1. Run ifconfig every 10 seconds
  2. Calculate the bytes TX+RX per second based on the ifconfig's results
  3. Multiply the bytes number by 8 (let's say this is X)
  4. Get the NIC speed settings (10mbps, 100mbps, 1000mbps, this is Y)
  5. Calculate the bandwidth percent usage as: X / (Y*1024*1024)

Is this correct? How does duplicity impact this calculation?

Theoretically this is correct. However, using ifconfig to retrieve the relevant figures is a very roundabout way to achieve this. You'd be much better off using SNMP. All interfaces have entries in the standard SNMP MIBs, which describe them and also their current connection speed, plus all sorts of relevant counters.

SNMP is available through standard packages in all linux distros I know off, and you can either use tools such as snmpwalk or snmpget (if you just want to retrieve the data) or MRTG or cacti (if you want to graph the data). Especially cacti will allow to apply formulae (formulas?) to your data, and it should be easy to get a percentage graph out of that.

  • 4
Reply Report
      • 2
    • Thank you for your response. Actually, I was more focusing on the calculation than the method of obtaining the data. How does duplicity impact the calculation?

Trending Tags