-
Notifications
You must be signed in to change notification settings - Fork 34
Understanding Default SNMP Utilization Calculations
You have questions about how ktranslate calculates various utilization metrics.
ktranslate returns raw SNMP polling data in almost all cases. The following metrics are exceptions where calculations or conversions are applied:
- CPU utilization %
- Memory utilization %
- Interface utilization %
- Interface error %
- Metrics with
enumorconversionfunctions applied in their profile configuration
Metric name: kentik.snmp.CPU
CPU is generally returned by a direct OID that provides an integer or float value representing percentage utilization. In rare cases where only a CPU idle value is available, ktranslate converts it using:
CPU = 100 - CPU Idle
Metric name: kentik.snmp.MemoryUtilization
Unlike CPU, memory utilization is rarely available as a direct OID. ktranslate calculates it based on whichever combination of OIDs is available:
If Memory Used and Memory Free are available:
Memory Utilization = ( Memory Used / (Memory Free + Memory Used) ) * 100
If Memory Total and Memory Free are available:
Memory Utilization = ( (Memory Total - Memory Free) / Memory Total ) * 100
If Memory Total and Memory Used are available:
Memory Utilization = ( Memory Used / Memory Total ) * 100
If Memory Total, Memory Buffer, and Memory Cache are available:
Memory Utilization = ( ( Memory Total - (Memory Buffer + Memory Cache) ) / Memory Total ) * 100
Metric names: kentik.snmp.IfInUtilization | kentik.snmp.IfOutUtilization
Interface utilization follows the industry standard approach: calculate the delta in bits and divide by the product of the interface's configured speed and the polling time delta.
Assuming 1 is the previous data point and 2 is the most recent:
( ( ifHCInOctets_2 - ifHCInOctets_1 ) * 8 * 100 ) / ( (sysUptime_2 - sysUptime_1) * ifSpeed )
Numerator:
- Take the latest octet count minus the previous sample (delta).
- Multiply by
8to convert octets to bits. - Multiply by
100to set up percentage calculation.
Denominator:
- Take the latest
sysUptimeminus the previous sample (polling interval delta). - Multiply by the configured
ifSpeed(reported in bits).
Divide numerator by denominator to get the utilization percentage.
ktranslate uses ifHCInOctets (receive) or ifHCOutOctets (transmit), substituting ifHighSpeed for ifSpeed in the denominator as needed. See the source code for details.
Tip: A common cause of inaccurate interface utilization percentages is a misconfigured interface speed on the device that doesn't reflect the actual link speed. For example, a 1 Gbps MPLS circuit on a 10 Gbps interface would show utilization at only 10% of the real value. Consult your vendor's documentation for how to set the correct interface bandwidth.
Metric names: kentik.snmp.ifHCInOctets | kentik.snmp.ifHCOutOctets
Interface throughput uses ifHCInOctets (receive) or ifHCOutOctets (transmit).
Key unit conversions:
- 1 octet = 1 byte
- 1 octet = 8 bits
The raw SNMP measurement counts octets (bytes). To get bytes, use the metric directly. To get bits per second, multiply by 8 and convert to a per-second rate.
Metric names: kentik.snmp.ifInErrorPercent | kentik.snmp.ifOutErrorPercent
Interface error percentage is calculated using ifInErrors or ifOutErrors divided by ifHCInUcastPkts or ifHCOutUcastPkts. See the source code:
( ifInErrors / ifHCInUcastPkts ) * 100
or
( ifOutErrors / ifHCOutUcastPkts ) * 100
Other SNMP metrics are converted based on the enum and conversion functions in their respective SNMP profile.
| Profile Setting | Usage |
|---|---|
tag |
Overrides the name attribute with a friendly name sent in the exported payload. |
enum:[] |
Converts the integer value of a dimensional metric into an enumerated string value — for example, converting kentik.snmp.if_AdminStatus to up, down, or testing. |
conversion: hextoint: <current>: <desired> |
Converts hexadecimal values to integer format. Options for current: LittleEndian | BigEndian. Options for desired: uint16 | uint32 | uint64. |
conversion: hextoip |
Converts hexadecimal values to 4-octet IPv4 strings. |
conversion: hwaddr |
Converts hexadecimal values to MAC address strings. |
conversion: powerset_status |
Enumerates the upsBasicStateOutputState ASCII string in the POWERNET-MIB. |
conversion: regexp |
Captures a substring from the OID output via regex match. Must be quoted with backslashes escaped. Example: input " 5 Secs ( 96.3762%) 60 Secs ( 62.8549%) 300 Secs ( 25.2877%)" with conversion "regexp:60 Secs.*?(\\d+)" returns 62. |
conversion: to_one |
Creates a gauge metric with value 1 for non-numeric scalar OIDs that have no enumeration options, such as tlUpsTestResultsDetail which returns a DisplayString. |