Solved

snmpwalk - limit output to 1st line

Posted on 2011-09-13
2
799 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:m0nk3yza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
sameer_dubey earned 500 total points
ID: 36527781
Some options for you:

1. Check the return code

2. Don't use snmpwalk, use snmpget instead
0
 
LVL 1

Author Closing Comment

by:m0nk3yza
ID: 36528197
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question