user2179455 user2179455 - 3 months ago 6x
SQL Question

SNMP OUTPUT OPTIONS - How do I get the OID response value only?

I have to go through and collect a few OIDs from some SNMP enabled network printers with a BASH script I have been working on.

My Request:

snmpget -v2c -c public

My Actual Response:

. = Counter32: 1974
. = Counter32: 633940

The Desired Response:


(just the oid values only)

I looked and tested several options using the resource from the site below:

removes '=' so running

snmpget -v2c -c public -Oq


. Counter32: 1974
. Counter 32: 633940314

so I know I am phrasing my request properly.

I am taking the values and writing them to a MYSQL dB, I set the data types in my tale schema, the request is consistent so I know the definition of the OID, so I do not need all the information I am getting back, just the value of the OID itself, so I can write it to my dB without manipulating the the response. I probably can manipulate the response pulling the information to the right of ":" and writing the value of the OID.

I am relatively new to SNMP (, but I can not see why this is not a more commonly asked question because I have been searching everywhere for an answer and this post is my last recourse...


You can tune the output with the -O argument:

snmpgetnext -Oqv -v 2c -c public .1

See the --help:

q:  quick print for easier parsing
v:  print values only (not OID = value)