home > linux > scripts > extending-snmp-for-custom-values

Extending SNMP for Custom Values

19 | 23 Jun 2014

snmp

To extend the snmp table, just add a line to the config of the snmp daemon (/etc/snmp/snmpd.conf), with four parameters, extend, value name, shell and shell file or binary full path.

Example Extend Config

extend userspace_ram /bin/sh /usr/local/bin/check_userspace_mem.sh

the snmp table will be extended with two values, one with a text value from the script, and one from the response code. In the majority of cases an integer value between 0 and 255 will be sufficient, so you can rely off the exit code of the script.

To see the new values, test with snmpwalk;

Example SNMP Walk

snmpwalk -mALL -v1 -cdefault localhost NET-SNMP-EXTEND-MIB::nsExtendResult

to get the full path or integer oid's, use the switches; -O f or -O n.

Post a Comment