Extend snmp agent functionality on Linux machine
This guide is to help extend the functionality of an snmp agent on a Linux machine. This allows for custom OID's to be queried from an snmp master to the agent. This also be subject to a program or script running and returning the value.
Ensure that snmpd is installed. sudo apt-get install snmpd.
First thing is to make some changes to the SNMP agent. In /etc/snmp/snmpd.conf ensure that the line "rocommunity public default -V systemonly" has the -V systemonly removed. This allows for the machine to access more than just basic system OID's.
To add the actual extend functionality add the line "extend test /bin/echo hello" or the equivalent for the action that you want to make. This is effectively the OID extension 'test' the program or script to be executed '/bin/echo' and the inputs to the program. The return value of the scripts will be sent by the SNMP agent. Ensure that the program path is correct.
Use the command to validate "snmpwalk -v2c -c public 127.0.0.1 nsExtendOutput1"
Another change that may be required is to install the mibs on the Linux snmp master. This can be done with the following command.
$ sudo apt-get install snmp-mibs-downloader $ sudo download-mibs
And then add the following line into the snmp.conf file. mibs +ALL
To get the OID use the command