S
S
sebastian2011-12-06 10:20:15
SNMP
sebastian, 2011-12-06 10:20:15

snmpwalk - stop output?

How to limit snmpwalk output? The problem is that you can’t get by with the usual grep, tail, head, because snmpwalk returns several thousand lines, and I need the first 50, for example. Until it reads everything, the script is no longer executed.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
@
@sledopit, 2011-12-06
@sebastian

So your problem is not in the heads and tails, they work fine. And the fact that they cut, as they were told, 50-100 lines, and snmpwalk does not end after that, but continues to honestly generate content that you no longer need.
Here is about the same difference as between
cat big_file | head -10and Here is a visual test with a half- gig head -10 big_file
text file for you:
$ time cat test > /dev/null
real 0m6.708s
$ time cat test | tail -10 > /dev/null
real 0m6.297s
$ time tail -10 test > /dev/null
real 0m0.007s

(snmpawlk | head -50 & ) ; sleep сколько_там_надо_времени_нагенерить_50_строк+запас ; killall snmpwalk

M
m0ps, 2011-12-06
@m0ps

why not get only the necessary data from certain OIDs through snmpwalk?

P
pentarh, 2011-12-06
@pentarh

so you pipe read that. will display as much as you read.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question