Pass persist
From Net-SNMP Wiki
The pass_persist option is very useful if you need to implement some specific OID subtree, but it has a few traps and features which are poorly communicated, or not even mentioned in the snmpd.conf man page.
- the shutdown protocol: when the snmpd server wants to shutdown, it tells your script by sending a blank line on stdin.
- snmpd sends a PING at the start of every request (I read the docs to mean that it is sent once, on script startup).
- the list of types you can return is quite limited. It is actually described in the docs for pass, which says that the type must be "one of the text strings: integer, gauge, counter, timeticks, ipaddress, objectid, or string"
- because you cannot return DateAndTime (RFC 2579), for datetime values I've resorted to returning two values (two separate OIDs):
- seconds-since-epoch
- datetime formatted as ISO-8601 string
Other things I've learned:
- your MIB must be valid, otherwise snmpget won't even query the daemon (http://dreness.com/wikimedia/index.php?title=Net_SNMP)
- you will probably need to add a line to the security section of snmpd.conf, to allow access to the OID subtree.
- I used python to implement my pass_persist script. You must flush stdout after sending each line, otherwise snmpd will timeout after waiting for your response.