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


i have go through , collect few oids snmp enabled network printers bash script have been working on.

my request:

snmpget -v2c -c public 192.168.0.77  .1.3.6.1.2.1.1.1  .1.3.6.1.2.1.1.2  

my actual response:

 .1.3.6.1.2.1.1.1 = counter32: 1974   .1.3.6.1.2.1.1.2 = counter32: 633940 

the desired response:

1974 633940314 

(just oid values only)

i looked , tested several options using resource site below:

http://www.netsnmp.org/docs/man/snmpcmd.html#lbaf

-oq removes '=' running

snmpget -v2c -c public -oq 10.15.105.133 .1.3.6.1.2.1.1.1  .1.3.6.1.2.1.1.2  

returns

.1.3.6.1.2.1.1.1 counter32: 1974 .1.3.6.1.2.1.1.2 counter 32: 633940314 

so know phrasing request properly.

i taking values , writing them mysql db, set data types in tale schema, request consistent know definition of oid, not need information getting back, value of oid itself, can write db without manipulating the response. can manipulate response pulling information right of ":" , writing value of oid.

i relatively new snmp (http://www.net-snmp.org/), can not see why not more commonly asked question because have been searching everywhere answer , post last recourse...

you can tune output -o argument:

snmpgetnext -oqv -v 2c -c public 192.168.0.77 .1 2 

see --help:

q:  quick print easier parsing v:  print values (not oid = value) 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -