A comprehensive Python SNMP library supporting v1/v2c/v3 with authentication and privacy protocols
84
Build a simple network device monitoring utility that can query SNMP-enabled devices on a local network. The utility should support querying devices using their hostname or IP address and handle network communication properly.
The utility should:
@generates
def query_device(target: str, community: str = "public", timeout: int = 5) -> dict:
"""
Query an SNMP-enabled device and retrieve basic system information.
Args:
target: IP address or hostname of the device
community: SNMP community string (default: "public")
timeout: Connection timeout in seconds (default: 5)
Returns:
Dictionary with keys:
- 'description': System description string
- 'uptime': System uptime in timeticks
- 'error': Error message if query failed (optional)
Raises:
ValueError: If target is empty or invalid
"""
passProvides SNMP protocol implementation and network communication support.
Install with Tessl CLI
npx tessl i tessl/pypi-pysnmpevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10