Marcio Cunha

Network slow? How to check switch latency via SNMP

Learn how to monitor your network switches using SNMP and snmpwalk. Detect bottlenecks and packet loss before they impact your production traffic.

Marcio Cunha•3 min
Also available in:PortuguêsEspañol
Summary
  • SNMP monitoring provides real-time visibility into traffic passing through every physical switch port.
  • Identifying interface errors and packet discards is essential for isolating hardware issues or congestion.
  • Using snmpwalk simplifies exploring available OIDs to extract performance metrics at no additional cost.
  • Analyzing packet transmission and discard counters helps determine if the issue lies in the link or traffic load.
  • Standardizing SNMP queries avoids reliance on proprietary graphical interfaces that may hide necessary raw data.

Why monitor latency at the switch level?

When a network feels sluggish, the blame often falls on the firewall or the server, but the bottleneck is frequently hidden deep within the switch ports. In corporate environments, invisible traffic like broadcast storms or physical layer errors consumes resources silently. Monitoring managed switches via SNMP (Simple Network Management Protocol) is the most effective way to get raw data on what is actually happening on each connected cable.

SNMP is a protocol that allows network devices to communicate with a monitoring server, sending performance statistics. In practice, you query the switch by asking how many errors it has encountered or how many packets it discarded within a specific interval. This prevents you from guessing where the network is failing, allowing for a proactive approach, similar to how we perform packet loss diagnosis with mtr to isolate problematic paths.

Understanding OIDs: the map of your network

OIDs (Object Identifiers) act as specific addresses that point to information within the device, such as temperature or total transmitted packets. Each manufacturer organizes this information in a base called MIB (Management Information Base), but most switches follow the MIB-II standard for basic interface statistics.

To get started, you will need a tool like snmpwalk, available on most Linux distributions. It scans the device and returns a complete list of values associated with each OID. It is a technical mining job where every line of text can reveal a CRC error or a buffer overflow (when the switch buffer fills up and it starts dropping data because it cannot process it fast enough).

Step-by-step: querying port statistics

To measure traffic and identify potential bottlenecks on a specific port, we will use the snmpwalk command. Follow these steps on your management machine:

  1. Ensure SNMP is enabled on the switch with the read community correctly configured.
  2. Execute the command to list interface names and their respective indices:
    snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.2.1.2.2.1.2
  3. Identify the index of the port showing latency and query the error packet counter (ifInErrors):
    snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.2.1.2.2.1.14.[INDEX]
  4. Compare the returned value with the previous time to calculate the error growth rate.
  5. Check packet discards using the input discard OID:
    snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.2.1.2.2.1.13.[INDEX]

What the numbers reveal about performance

When you get the ifInErrors or ifOutDiscards values, it is time to interpret the data. If errors are rising, you almost always have a physical problem: a poorly crimped network cable, electromagnetic interference (EMI), or a faulty SFP module. Verifying these counters is as vital as testing voltages on electronic components, as both deal with the basic health of the infrastructure.

If discards are high, the problem is purely congestion. The switch is receiving more traffic than its CPU or internal backplane can process at that moment. This is common in networks with heavy backup traffic or large file transfers, where proper segmentation is key, just as when configuring VLANs to isolate traffic.

Final considerations

Diagnosing switch latency is not about finding a magic command, but understanding the behavior of interface counters over time. SNMP provides the foundation for this visibility, turning raw data into informed technical decisions that avoid production outages.

By implementing constant monitoring of the mentioned OIDs, you stay ahead of problems, acting on the infrastructure before slowness turns into a total outage. Remember that in the world of networking, observability is the only path to stability.