aiosnmp is an asynchronous SNMP client for use with asyncio.
pip install aiosnmp
https://aiosnmp.readthedocs.io/en/latest/api.html
Only snmp v2c supported, v3 version is not supported
Oids should be like
.1.3.6...
or 1.3.6...
. iso.3.6...
is not supportedBy default, v2c should not validate source addr, but in this library, it is enabled by default.
You can disable validation by passing validate_source_addr=False
to Snmp
.
import asyncio
import aiosnmp
async def main():
async with aiosnmp.Snmp(host="127.0.0.1", port=161, community="public") as snmp:
for res in await snmp.get(".1.3.6.1.2.1.1.1.0"):
print(res.oid, res.value)
asyncio.run(main())
more in /examples
- snmp v3 support
- more tests
aiosnmp is developed and distributed under the MIT license.
pip install -r requirements-dev.txt
tox
pip install -r requirements-dev.txt
tox -e format