SNMP Walk Script

Started my first sys admin job after graduating in Jan, and last week i was required to do multiple SNMP walks to servers for specific information HDD. I had done very little scripting before on my home PC, with an actual problem its so much easier to get started with bash. So here is my small script.


#!/bin/bash



list="server1 server2 server3"



function pause(){
   read -p "$*"
}


for item in $list
do
   echo $item
   $echo snmpwalk -c public -Oa -v1 $item (OID of your choice)

   read -p "Press [Enter] key to see next walk"
done




#William Fleming Script
#william20111@gmail.com
#http://kerneltalk.co.uk


It just fires through each of your servers in the list and drops out the specific information, in a readable format. Nothing spectacular but was worth the 30mins it took me to hack it together. Im no bash guru, but thought i would share this on here if you ever need to do something similar. It does require the net-snmp tool from the repos to run.

Thanks
William

Hi, welcome and thanks for sharing.

Being a lover of clean, clean, clean coding, should the pause function be removed? I don’t see a call for it in the rest of the script.

Sorry yes ill remove it i had been changing a few things with pauses, then just opted for hitting enter to get the next walk. Ill take that out.

Thanks
William