SNMP Extend with yaml discovery

When working with snmp extend how do you control what the discovery yaml can query. I created two extends, “process1” and "process2"

#snmpd.conf on server 1
extend process1 /usr/local/bin/check_process1

#snmpd.conf on server 2
extend process2 /usr/local/bin/check_process2

#yaml file
mib: NET-SNMP-EXTEND-MIB
modules:
sensors:
state:
data:
-
oid: nsExtendOutLine.“process1”
num_oid: ‘nsExtendOutLine.“process1”.1’
descr: ‘process1’
states:
- { descr: normal, graph: 1, value: 1, generic: 0 }
- { descr: alarm, graph: 1, value: 0, generic: 2 }
-
oid: nsExtendOutLine.“process2”
num_oid: ‘nsExtendOutLine.“process2”.1’
descr: ‘process2’
states:
- { descr: normal, graph: 1, value: 1, generic: 0 }
- { descr: alarm, graph: 1, value: 0, generic: 2 }

#discovery with verbose for server1
Caching data: sensors SNMP[’/usr/bin/snmpbulkwalk’ ‘-v3’ ‘-l’ ‘authPriv’ ‘-n’ “” ‘-a’ ‘SHA’ ‘-A’ ‘password’ ‘-u’ ‘librenmsro’ ‘-x’ ‘AES’ ‘-X’ ‘password’ ‘-OteQUs’ ‘-Ih’ ‘-m’ ‘NET-SNMP-EXTEND-MIB’ ‘-M’ ‘/opt/librenms/mibs’ ‘udp:server1:161’ ‘nsExtendOutLine.“process1”’]

#discovery with verbose for server2
Caching data: sensors SNMP[’/usr/bin/snmpbulkwalk’ ‘-v3’ ‘-l’ ‘authPriv’ ‘-n’ “” ‘-a’ ‘MD5’ ‘-A’ ‘password’ ‘-u’ ‘librenmsro’ ‘-x’ ‘DES’ ‘-X’ ‘password’ ‘-OteQUs’ ‘-Ih’ ‘-m’ ‘NET-SNMP-EXTEND-MIB’ ‘-M’ ‘/opt/librenms/mibs’ ‘udp:server2:161’ ‘nsExtendOutLine.“process2”’]

When I run the verbose discovery nothing is added. If I copy and paste the snmpbulkwalk command in the CLI I get the values I want to see.

#yaml file
mib: NET-SNMP-EXTEND-MIB
modules:
sensors:
state:
data:
-
oid: nsExtendOutLine
num_oid: ‘nsExtendOutLine.“process1”.1’
descr: ‘process1’
states:
- { descr: normal, graph: 1, value: 1, generic: 0 }
- { descr: alarm, graph: 1, value: 0, generic: 2 }
-
oid: nsExtendOutLine
num_oid: ‘nsExtendOutLine.“process2”.1’
descr: ‘process2’
states:
- { descr: normal, graph: 1, value: 1, generic: 0 }
- { descr: alarm, graph: 1, value: 0, generic: 2 }

**This didn’t work out any better. The snmp string is good but the lnms displays the last oid in the yaml and the state checks do not work. **

Again… copying the debug strings into the CLI returns the values I want to see.

Should I be doing this in a state sensor php?

It appears to be a limitation with the yaml discovery. I put everything in a php file and it is all working good.