A comprehensive Python SNMP library supporting v1/v2c/v3 with authentication and privacy protocols
84
Build a network device monitoring tool that retrieves system information from network devices using SNMP GET operations.
Create a Python program that connects to a network device via SNMP and retrieves specific system information. The program should:
description, uptime, contact, name@generates
import asyncio
from typing import Dict, Optional
async def get_device_info(hostname: str, port: int = 161, community: str = "public") -> Dict[str, Optional[str]]:
"""
Retrieve system information from a network device using SNMP GET operations.
Args:
hostname: The hostname or IP address of the device
port: The SNMP port (default: 161)
community: The SNMP community string (default: "public")
Returns:
A dictionary containing:
- description: System description string
- uptime: System uptime value
- contact: System contact information
- name: System name
If an error occurs retrieving a specific value, that key should contain None.
Raises:
Exception: If unable to establish SNMP connection or critical error occurs
"""
passProvides SNMP protocol implementation for network device communication.
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