Writing an snmp script to grab multiple oids at once


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Writing an snmp script to grab multiple oids at once
# 1  
Old 01-31-2012
Writing an snmp script to grab multiple oids at once

is it possible to grab the following oids with one invocation of the snmp command, instead of having to run separate commands:

Code:
snmpwalk -v2c -c commst hostname hrStorageUsed

snmpwalk -v2c -c commst hostname hrStorageDescr

snmpwalk -v2c -c commst hostname hrStorageAllocationUnits

snmpwalk -v2c -c commst hostname hrStorageSize

i'd like to run something like this so i can get all their responses in one command line:

Code:
snmpwalk -v2c -c commst hostname "hrStorageUsed|hrStorageDescr|hrStorageAllocationUnits|hrStorageSize"

is this possible?
# 2  
Old 01-31-2012
Hi,

have you tried:
Code:
snmpwalk -v2c -c commst hostname | egrep "hrStorageUsed|hrStorageDescr|hrStorageAllocationUnits|hrStorageSize"

see ya
fra
# 3  
Old 01-31-2012
Quote:
Originally Posted by frappa
Hi,

have you tried:
Code:
snmpwalk -v2c -c commst hostname | egrep "hrStorageUsed|hrStorageDescr|hrStorageAllocationUnits|hrStorageSize"

see ya
fra
that's what i have been doing but i was thinking there may be a better way?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Open Source

Help with writing Shell Script to automate process using multiple commands

Hello! Need help to write a Linux script that can be run from windows using command/Cygwin/any other way. I am new to scripting, actually i am trying to automate server health check like free disk space, memory along with few services status, if any services is not running then start services ,... (7 Replies)
Discussion started by: Sayed Ibrahim
7 Replies

2. Shell Programming and Scripting

Q: grab email username from script

Hi all, I want to set up a script to email a person to confirm another program is running but i wish to avoid having to customise the script for each individiual. I am ok with what i need to do except i need to get the first and last name of the user to construct an email address to send to.... (6 Replies)
Discussion started by: KlintJ
6 Replies

3. UNIX for Dummies Questions & Answers

Writing a script to print the number of lines in multiple files

Hi I have 1000 files labelled data1.txt through data1000.txt. I want to write a script that prints out the number of lines in each txt file and outputs it in the following format: Column 1: number of data file (1 through 1000) Column 2: number of lines in the text file Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

4. Programming

Perl SNMP set pdu with multiple values

Hi, I'm trying to set two OID's in the same PDU (so both OIDs and values are sent in the same packet) at present I am only able to send one at a time which does not trigger the hardware response as the two specific OID's need to be set simultaneously in order to work. I'm using perl along... (0 Replies)
Discussion started by: MCLASS
0 Replies

5. UNIX for Dummies Questions & Answers

Writing a loop to process multiple input files by a shell script

I have multiple input files that I want to manipulate using a shell script. The files are called 250.1 through 250.1000 but I only want the script to manipulate 250.300 through 250.1000. Before I was using the following script to manipulate the text files: for i in 250.*; do || awk... (4 Replies)
Discussion started by: evelibertine
4 Replies

6. Shell Programming and Scripting

Writing a Perl Script that processes multiple files

I want to write a Perl script that manipulates multiple files. In the directory, I have files 250.*chr$.ped where * is from 1 to 1000 and $ is from 1-22 for a total of 22 x 10,000 = 22,000 files. I want to write a script that only manipulates files 250.1chr*.ped where * is from 1 to 22.... (10 Replies)
Discussion started by: evelibertine
10 Replies

7. UNIX for Dummies Questions & Answers

Writing a loop to manipulate a script and store it in multiple output files

I have a script where the the 9th line looks like this: $filename=sprintf("250.1chr%d.ped", $N); I want to modify this script 1000 times, changing 250.1chr%d.ped to 250.2chr%d.ped, 250.3chr%.ped.......and so on all the way to 250.1000chr%d.ped and store each output in files called ... (4 Replies)
Discussion started by: evelibertine
4 Replies

8. Shell Programming and Scripting

Writing a script for multiple occurence of IP_Add in 3 diffrent directories .

Hello members. How can i write a script to find a multiple occurence of IP_ADD in the 3 different directories and under one path.after finding the IP_add redirect into a text file. for example home dir: /fdp/cdg under home directory there are several files and directories.so I have to... (1 Reply)
Discussion started by: rajkumar_g
1 Replies

9. Infrastructure Monitoring

snmp config grab - right off Ciscos Page

I need to update my scripts. I have been using depreciated oids. I referred to the Cisco site docs and found snmpset -v 2c -c .1.3.6.1.4.1.9.9.96.1.1.1.1.2. i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.3. i 4 .1.3.6.1.4.1.9.9.96.1.1.1.1.4. i 1 .1.3.6.1.4.1.9.9.96.1.1.1.1.5. a ""... (0 Replies)
Discussion started by: popeye
0 Replies

10. Shell Programming and Scripting

script to grab lines between two values

hi guys say I have a file that contains hello world this is AAAAA message to try BBBBBB and see if anyone AAAAA knows the (3 Replies)
Discussion started by: JamesByars
3 Replies
Login or Register to Ask a Question