Previously, only exec and extend can be configured in snmpd. conf to manage MIB nodes elastically using scripts (or executable files. It is also constantly suffering from the troubles they bring, that is, when the values required by get or walk, many results will be returned through the appended leaf node, the consequence is that it is not compatible with many standard SNMP management software.
Now we have a perfect solution. Let's look at man snmpd. in the pass-through control section of conf, it indicates that the node value can be dynamically managed using the pass miboid exec syntax. miboid is passed to the script as a parameter, and the output of the script is in the specified format, print the miboid, type, and value in the three rows respectively.
What's more, set! This is not what exec and extend can do.
Attached example:
Add a sentence to snmpd. conf,
Pass. 1.3.6.1.4.1.2021.255/root/passtest
/Root/Write a bash script passtest,
#! /Bin/bash
Echo $2 # Because snmpd uses Exec-G miboid to call the script, miboid is the second parameter.
Echo integer
Echo 13
Snmpd can be restarted to directly snmpget it.
[Root @ localhost ~] # Snmpget-V 2C-C public localhost. 1.3.6.1.4.1.2021.255
UCD-SNMP-MIB: ucdavis.255 = integer: 13
I don't know how I missed such a strong feature, or I didn't have it yet...
Additionally, pass_persist is another form of pass (replacing scripts with a daemon). The output of the daemon must strictly follow the protocol format. For more information, see man snmpd. conf.