sudo find /opt/network-worker -type d -name pycache -exec rm -rf {} + 2>/dev/null; sudo systemctl restart network-worker
snmpwalk -v2c -c public 192.168.0.105 1.3.6.1.2.1.1.1.0
/opt/network-worker/venv/bin/python3 -c „
from pysnmp.hlapi.v3arch.asyncio import *
import asyncio
async def test():
r = await get_cmd(
SnmpEngine(),
CommunityData(‚public‘),
await UdpTransportTarget.create((‚192.168.0.105‘, 161), timeout=5, retries=1),
ContextData(),
ObjectType(ObjectIdentity(‚1.3.6.1.2.1.1.1.0‘))
)
err_indication, err_status, err_index, var_binds = r
if err_indication:
print(f’FEHLER: {err_indication}‘)
elif err_status:
print(f’SNMP Error: {err_status}‘)
else:
for oid, val in var_binds:
print(f’OK: {val.prettyPrint()}‘)
asyncio.run(test())
„
Update
