awk parse snmp results


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk parse snmp results
# 8  
Old 08-19-2015
Just to be clear, ... was meant as a placeholder for the command you want to run, in this case snmptable -v2c -c public myIP IF-MIB::ifTable, for you wrote:
Quote:
Originally Posted by wanttolearn1
how can i get a row by the first column certain value (ifIndex), and a certain column in that row?
My intention was to highlight the parsing of the output, which could be used with any command.

To make sure that things are being sliced and diced as expected, you might find it useful to run:
Code:
... | awk '{
  print "NR:", NR;
  print "NF":", NF;
  for (i = 0; i <= NF; i++) print "$" i, $i;
}'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

AIX native SNMP producing limited results when walking MIB tree

The company I work for has various AIX servers that I've recently migrated to AIX 7.1 (from 6.1). Some are powerHA clusters some are not. Likewise, the systems engineer that I replaced had net-snmp installed on said clustered systems. Long story short I am re-invoking AIX's native SNMP (v3) for... (1 Reply)
Discussion started by: davix
1 Replies

2. UNIX for Dummies Questions & Answers

Need to transfer all kernel logs (var/log/messages) to the snmp listener as snmp trap

i am working with embedded system -Dell DCS management sub system. my question is as below: currently we are using linux kernel 2.6.30 build and we have a kernel logs stored to the /var/log/messages path. now we have to transfer all this logs to the specified SNMP target as a part of SNMP... (4 Replies)
Discussion started by: vipul_prajapati
4 Replies

3. Shell Programming and Scripting

Substitute from awk results

Hi, The following awk command : asmcmd lsdg | awk '{print $13;}' | grep -i ${SID} return the following output . An Empty line + two lines contain "/" at the end of the line INDEVDATA/ INDEVFRA/ I need to remove the "/" as well as the empty line. Please advise Thanks (3 Replies)
Discussion started by: Yoav
3 Replies

4. Red Hat

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (1 Reply)
Discussion started by: prabakar4all
1 Replies

5. IP Networking

Sending data from DELL OMSA SNMP and Custom SNMP MIB to same UDP port 161

Hi , Currently DELL OMSA SNMP sends data through default udp port 161.I want my custom SNMP MIB also to send data in the same udp port 161.Whether its possible.If yes where to configure .I tried starting my custom MIB in udp port 161,but it throws port already in use.Kindly guide. (0 Replies)
Discussion started by: prabakar4all
0 Replies

6. Shell Programming and Scripting

awk script to parse results from TWO files

I am trying to parse two files and get data that does not match in one of the columns ( column 3 in my case ) Data for two files are as follows A.txt ===== abc 10 5 0 1 16 xyz 16 1 1 0 18 efg 30 8 0 2 40 ijk 22 2 0 1 25 B.txt ===== abc... (6 Replies)
Discussion started by: roger67
6 Replies

7. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

8. Shell Programming and Scripting

need a little help with results from awk

Hi there all, I am using a line to get some replys from my PS I do ps -ef |awk '{printf $9}' But my result is 1 big line. No spaces between the lines or someting for example:... (2 Replies)
Discussion started by: draco
2 Replies

9. Shell Programming and Scripting

Shell Script Needed to Parse Results

Raw Results: results|192.168.2|192.168.2.1|general/udp|10287|Security Note|For your information, here is the traceroute from 192.168.2.24 to 192.168.2.1 : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2|192.168.2.1|ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

10. Shell Programming and Scripting

AWK - no search results

Hi all, I'm new to awk and I'm experiencing syntax error that I don't know how to resolve. Hopefully some experts in this forum can help me out. I created an awk file that look like this: $ cat myawk.awk BEGIN { VAR1=PATTERN1 VAR2=PATTERN2 } /VAR1/ { flag=1 } /VAR2/ { flag=0 } {... (7 Replies)
Discussion started by: hk18
7 Replies
Login or Register to Ask a Question
SNMPTABLE(1)							     Net-SNMP							      SNMPTABLE(1)

NAME
snmptable - retrieve an SNMP table and display it in tabular form SYNOPSIS
snmptable [COMMON OPTIONS] [-Cb] [-CB] [-Ch] [-CH] [-Ci] [-Cf STRING] [-Cw WIDTH] AGENT TABLE-OID DESCRIPTION
snmptable is an SNMP application that repeatedly uses the SNMP GETNEXT or GETBULK requests to query for information on a network entity. The parameter TABLE-OID must specify an SNMP table. snmptable is an SNMP application that repeatedly uses the SNMP GETNEXT or GETBULK requests to query for information on a network entity. The parameter TABLE-OID must specify an SNMP table. AGENT identifies a target SNMP agent, which is instrumented to monitor the gievn objects. At its simplest, the AGENT specification will consist of a hostname or an IPv4 address. In this situation, the command will attempt communication with the agent, using UDP/IPv4 to port 161 of the given target host. See snmpcmd(1) for a full list of the possible formats for AGENT. OPTIONS
COMMON OPTIONS Please see snmpcmd(1) for a list of possible values for COMMON OPTIONS as well as their descriptions. -Cb Display only a brief heading. Any common prefix of the table field names will be deleted. -CB Do not use GETBULK requests to retrieve data, only GETNEXT. -Cc CHARS Print table in columns of CHARS characters width. -Cf STRING The string STRING is used to separate table columns. With this option, each table entry will be printed in compact form, just with the string given to separate the columns (useful if you want to import it into a database). Otherwise it is printed in nicely aligned columns. -Ch Display only the column headings. -CH Do not display the column headings. -Ci This option prepends the index of the entry to all printed lines. -Cl Left justify the data in each column. -Cr REPEATERS For GETBULK requests, REPEATERS specifies the max-repeaters value to use. For GETNEXT requests, REPEATERS specifies the number of entries to retrieve at a time. -Cw WIDTH Specifies the width of the lines when the table is printed. If the lines will be longer, the table will be printed in sections of at most WIDTH characters. If WIDTH is less than the length of the contents of a single column, then that single column will still be printed. EXAMPLES
$ snmptable -v 2c -c public localhost at.atTable SNMP table: at.atTable RFC1213-MIB::atTable atIfIndex atPhysAddress atNetAddress 1 8:0:20:20:0:ab 130.225.243.33 $ snmptable -v 2c -c public -Cf + localhost at.atTable SNMP table: at.atTable atIfIndex+atPhysAddress+atNetAddress 1+8:0:20:20:0:ab+130.225.243.33 $ snmptable localhost -Cl -CB -Ci -OX -Cb -Cc 16 -Cw 64 ifTable SNMP table: ifTable Index Descr Type Mtu Speed PhysAddress AdminStatus OperStatus LastChange InOctets InUcastPkts InNUcastPkts InDiscards InErrors InUnknownProtos OutOctets OutUcastPkts OutNUcastPkts OutDiscards OutErrors OutQLen Specific index: [1] 1 lo softwareLoopbac 16436 10000000 up up ? 2837283786 3052466 ? 0 0 ? 2837283786 3052466 ? 0 0 0 zeroDotZero index: [2] 2 eth0 ethernetCsmacd 1500 10000000 0:5:5d:d1:f7:cf up up ? 2052604234 44252973 ? 0 0 ? 149778187 65897282 ? 0 0 0 zeroDotZero BUGS
The test for TABLE-OID actually specifying a table is rather heuristic. Note also that the test requires the defining MIB file to be loaded. SEE ALSO
snmpcmd(1), variables(5). 4th Berkeley Distribution 25 Jul 2003 SNMPTABLE(1)