snmpwalk - limit output to 1st line
Posted on 2011-09-13
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
But they all still return the whole OID.
Adding "| head -2" still causes the full command to run and takes very long.