You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm setting an OctetString as follows as an SNMP DateTime object
I'm not sure if the way I'm setting the DateTime is correct for SNMP, but when I do a snmpwalk, I'm able to see the variable just fine. Except the program blows up when I call dump_registered()
setup
importstructimporttime# setup the agent as in simple_agent.py example, thentime_millisecs=1577836800000# convert milliseconds to an OctetStringvalue=time.gmtime(time_millisecs/1000)
value=struct.pack(
">HBBBBBB",
value.tm_year,
value.tm_mon,
value.tm_mday,
value.tm_hour,
value.tm_min,
value.tm_sec,
0,
)
new_row.setRowCell(2, agent.OctetString(value))
# the above is fine, but it then blows up when the following is calleddump_registered(agent)
stacktrace
Traceback (most recent call last):
File "./snmp_agent.py", line 465, in <module>
main()
File "./snmp_agent.py", line 435, in main
dump_registered(agent)
File "./snmp_agent.py", line 342, in dump_registered
variables = agent.getRegistered(context)
File "~/my_venv/lib/python3.8/site-packages/netsnmpagent.py", line 949, in getRegistered
"value": snmpobj.value()
File "~/my_venv/lib/python3.8/site-packages/netsnmpagent.py", line 895, in value
retdict[indices][int(data.contents.column)] = u(ctypes.string_at(data.contents.data.string, data.contents.data_len))
File "~/my_venv/lib/python3.8/site-packages/netsnmpagent.py", line 51, in u
return s if isinstance("Test", bytes) else s.decode(locale.getpreferredencoding())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 1: invalid continuation byte
Exception ignored in: <module 'threading' from '/usr/lib/python3.8/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 1388, in _shutdown
lock.acquire()
KeyboardInterrupt:
* Cleaning up...
The text was updated successfully, but these errors were encountered:
I'm setting an OctetString as follows as an SNMP DateTime object
I'm not sure if the way I'm setting the DateTime is correct for SNMP, but when I do a snmpwalk, I'm able to see the variable just fine. Except the program blows up when I call
dump_registered()
setup
stacktrace
The text was updated successfully, but these errors were encountered: