FreeBSD/scripts/fan.py

15 lines
365 B
Python
Raw Normal View History

2021-04-17 11:05:38 -07:00
# 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]