Python pysnmp增加内存
我使用pysnmp创建了一个脚本,用于监视目的。 它可以工作,但会增加内存使用,直到windows停止。 以下代码是从设备中获取值的主要功能, 似乎我需要在每次函数调用后清理缓存。 有人能帮我吗Python pysnmp增加内存,python,pysnmp,Python,Pysnmp,我使用pysnmp创建了一个脚本,用于监视目的。 它可以工作,但会增加内存使用,直到windows停止。 以下代码是从设备中获取值的主要功能, 似乎我需要在每次函数调用后清理缓存。 有人能帮我吗 from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.smi.rfc1902 import ObjectIdentity cmdGen = cmdgen.CommandGenerator() temperatureMIB='1.3.
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.smi.rfc1902 import ObjectIdentity
cmdGen = cmdgen.CommandGenerator()
temperatureMIB='1.3.6.1.4.1.5835.5.2.1000.1.33'
temperature1=''
def getdata_m1():
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('10.128.113,149', 161)),
ObjectIdentity(temperatureMIB),
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1] or '?'))
else:
for name, val in varBinds:
list1.append(str(val))`enter code here`
temperature1 = list1[0]
print(temperature1)```