15 lines
365 B
Python
15 lines
365 B
Python
# pkgk install py37-pysnmp
|
|
|
|
from pysnmp import hlapi
|
|
|
|
|
|
def get(target, oids, credentials, port=161, engine=hlapi.SnmpEngine(), context=hlapi.ContextData()):
|
|
handler = hlapi.getCmd(
|
|
engine,
|
|
credentials,
|
|
hlapi.UdpTransportTarget((target, port)),
|
|
context,
|
|
*construct_object_types(oids)
|
|
)
|
|
return fetch(handler, 1)[0]
|