Template:FAQ:Applications 15

From Net-SNMP Wiki
Jump to: navigation, search

The Net-SNMP library will normally try to interpret string-based index values, and display them in a meaningful manner:

     $ snmpgetnext .... vacmGroupName
     vacmGroupName.3."dave" = theWorkers

The command-line tools will also accept string-valued indexes within an OID, and convert them into the appropriate numeric form before sending an SNMP request. However the Unix shell will typically swallow the quotes around the string index value, before the SNMP tools can get a chance to interpret them.

The answer is to escape the quotes, to protect them from the shell, and allow them to be passed through to the OID parser:

     snmpget ....   vacmGroupName.3.\"dave\"

or

     snmpget ....  'vacmGroupName.3."dave"'

Another alternative is to avoid trying to specify the index value as a string, and provide the numeric subidentifiers directly:

     snmpget .... vacmGroupName.3.4.100.97.118.101

(where '3' indicates SNMPv3, '4' is the length of the string index, followed by the ASCII values of the individual characters).

The command-line option '-Ob' will display the results of querying a string-indexed table in this format:

     $ snmpgetnext -Ob .... vacmGroupName
     vacmGroupName.3.4.100.97.118.101 = theWorkers