Link to home
Start Free TrialLog in
Avatar of m0nk3yza
m0nk3yzaFlag for South Africa

asked on

snmpwalk - limit output to 1st line

Hi Guys,

Is there a way to limit the output of snmpwalk to only display the first 1 or 2 lines?
I only need to test whether snmpwalk is successful or not (I don't need the full output of the snmpwalk command).

We have to test snmp connectivity for all our different clients' devices.

I use the following from our CentOS 4.9 server to test:

snmpwalk -c s3cret -v 2c 10.10.10.123:161
<This produces large amounts of output>

I'll script it to test a 100 random IPs.
I don't want the full OID to be dumped to screen, as this exersice is purely to determine if the device responds to snmp.

I've tried options like:
snmpwalk -O q -n 3
snmpwalk -Oq

But they all still return the whole OID.

Adding  "| head -2"  still causes the full command to run and takes very long.

Thank you,

J
ASKER CERTIFIED SOLUTION
Avatar of sameer_dubey
sameer_dubey
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of m0nk3yza

ASKER

Awesome!
snmpget is exactly what I needed.
Thank you.

snmpget -v 2c -c public -m IF-MIB 10.10.10.123 ifDescr.1 ifSpeed.1
IF-MIB::ifDescr.1 = STRING: Ethernet Interface
IF-MIB::ifSpeed.1 = Gauge32: 100000000