I  raised this issue on GitHub before I realised that this mailing list existed:

I am using a traphandle directive to send the output of snmptrapd to an 
external Python program.
The Python script creates a JSON object and publishes on MQTT, and another 
microservice eventually writes this to InfluxDB.
It works well up to a point.

The Python script needs to know what datatype is used for each varbind value.
For example, in the trap data that my script reads from stdin, some strings are 
enclosed in quotes, but some are not. So it is impossible to know if a 
particular value is a string, an integer, or a counter.

What is really strange is that the snmptrapd output to stdout or stderr DOES 
include the datatype information. E.g. IF-MIB::ifPhysAddress.1 = STRING: 
But this same varbind appears to the traphandler like this: 
IF-MIB::ifPhysAddress.1 0:a:14:0:0:0.

I have experimented with every possible combination of command-line arguments 
(-L, -O, -t), snmptrapd.conf file directives ([snmp] logOption, outputOption, 
doNotLogTraps), and snmp.conf file directives (oidOutputFormat).
The fundamental problem seems to be that the output to stdout/stderr and the 
output to a traphandlers seem to follow different rules.

Can anyone tell me how to get datatype information to a traphandler?


Net-snmp-users mailing list
Please see the following page to unsubscribe or change other options:

Reply via email to