Skip to content

Network Monitoring And Snmp Tools

Category: Network Tools and Commands
Type: Network Tools & Commands
Generated on: 2025-07-10 09:30:10
For: Network Engineering, Administration & Technical Interviews


This cheatsheet covers essential tools for network monitoring using SNMP (Simple Network Management Protocol).

1. Tool Overview:

SNMP is a protocol used for managing network devices. Tools interact with SNMP agents (running on network devices) to gather information like CPU utilization, memory usage, interface statistics, etc. We’ll focus on snmpwalk, snmpget, snmpset, and net-snmp tools.

  • snmpwalk: Retrieves all values from an SNMP agent’s MIB (Management Information Base). Use for initial exploration and discovering available data.
  • snmpget: Retrieves specific values from an SNMP agent’s MIB. More efficient than snmpwalk for targeted information.
  • snmpset: Sets (modifies) values in an SNMP agent’s MIB. Use with extreme caution; incorrect settings can disrupt network operation. Generally avoided unless absolutely necessary for configuration changes.
  • net-snmp (Suite): A comprehensive suite of SNMP tools including snmpwalk, snmpget, snmpset, and more advanced utilities. Often preferred for its robustness and features.

When to Use:

  • Troubleshooting: Identify performance bottlenecks, detect device failures, diagnose connectivity issues.
  • Monitoring: Proactively track key metrics for capacity planning and performance optimization.
  • Configuration: (Use with caution!) Modify specific device settings via snmpset.
  • Automation: Integrate with scripting languages (e.g., Python, Bash) for automated tasks.

2. Basic Syntax:

(Assuming net-snmp is installed; otherwise, replace with system’s native commands):

  • snmpwalk -v <version> -c <community> <ip_address>: Walks the entire MIB.
  • snmpget -v <version> -c <community> <ip_address> <OID>: Gets a specific value.
  • snmpset -v <version> -c <community> <ip_address> <OID> <value>: Sets a specific value. (Use with extreme caution!)

Where:

  • <version>: SNMP version (1, 2c, 3). Version 3 is most secure, requiring authentication and encryption.
  • <community>: A shared secret string for authentication (SNMP v1/v2c). Avoid using default communities like “public” in production!
  • <ip_address>: IP address of the SNMP agent.
  • <OID>: Object Identifier, a unique identifier for a specific piece of information. (e.g., .1.3.6.1.2.1.1.1.0 for system description).
  • <value>: The new value to set (for snmpset).

3. Practical Examples:

Example 1: snmpwalk

Terminal window
snmpwalk -v 2c -c public 192.168.1.100

(Sample Output - Partial):

SNMPv2-MIB::sysDescr.0 = STRING: Linux 5.15.0-76-generic #87-Ubuntu SMP Fri Feb 24 16:20:56 UTC 2023 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::mib-2.35
SNMPv2-MIB::sysUpTime.0 = Timeticks: 123456789
...more output...

Example 2: snmpget

Terminal window
snmpget -v 2c -c public 192.168.1.100 1.3.6.1.2.1.1.1.0

(Sample Output):

SNMPv2-MIB::sysDescr.0 = STRING: Linux 5.15.0-76-generic #87-Ubuntu SMP Fri Feb 24 16:20:56 UTC 2023 x86_64

Example 3: snmpset (Use with extreme caution!)

Terminal window
# Setting sysLocation (NOT RECOMMENDED without thorough understanding)
snmpset -v 2c -c private 192.168.1.100 1.3.6.1.2.1.1.6.0 s "New Location"

4. Common Options:

  • -v <version>: SNMP version (1, 2c, 3).
  • -c <community>: SNMP community string (v1/v2c).
  • -u <username>: SNMP username (v3).
  • -a <authProtocol>: Authentication protocol (v3, e.g., MD5, SHA).
  • -x <privProtocol>: Privacy protocol (v3, e.g., DES, AES).
  • -l <securityLevel>: Security level (v3, noAuthNoPriv, authNoPriv, authPriv).
  • -t <timeout>: Timeout in seconds.
  • -r <retries>: Number of retries.

5. Advanced Usage:

  • Filtering with OIDs: Use specific OIDs to target information.
  • SNMP v3: Employ strong authentication and encryption for enhanced security.
  • Scripting: Automate tasks using Python’s pysnmp library or similar tools. Example (Python with pysnmp):
from pysnmp.hlapi import *
for errorIndication, errorStatus, errorIndex, varBinds in nextCmd(
SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('192.168.1.100', 161)),
ContextData(),
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
):
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex)-1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))

6. Troubleshooting Scenarios:

  • snmpwalk fails: Check IP address, community string, SNMP service status on the target device, and network connectivity.
  • snmpget returns “noSuchObject”: Incorrect OID. Consult the device’s MIB.
  • snmpset fails: Insufficient permissions, incorrect OID, invalid value type.

7. Output Interpretation:

The output generally shows OIDs and their corresponding values. Understand the meaning of OIDs by consulting the device’s MIB documentation. Tools like snmptranslate can help decode OIDs.

8. Security Considerations:

  • Strong passwords/community strings: Avoid default communities. Use strong, unique passwords for SNMP v3.
  • SNMP v3: Always prefer SNMP v3 for its security features.
  • Access control: Restrict access to SNMP agents through firewalls and access lists.
  • Regular audits: Monitor SNMP activity for suspicious behavior.

9. Platform Differences:

  • Linux: net-snmp is commonly available through package managers (apt, yum, pacman).
  • Windows: SNMP is built-in; use the snmpwalk, snmpget, snmpset commands (may require enabling SNMP service).
  • macOS: SNMP tools may be available through Homebrew or other package managers. The basic commands are generally similar.

Disclaimer: Incorrect use of snmpset can severely damage network devices. Always test changes in a non-production environment first. Consult your device’s documentation before making any configuration changes via SNMP.