Solved

snmpwalk - limit output to 1st line

Posted on 2011-09-13
2
762 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
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 camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

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

Suggested Solutions

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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now