Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cisco Ping Mib

Status
Not open for further replies.

sumncguy

IS-IT--Management
May 22, 2006
118
US
I have the script taken off the cisco web page .. put have no idea of what its doing and how to grab results. What I need is something that will show be latency from one router to another using snmp ...
 

Here is the script taken from the Cisco site.
How do I get the results ?


#! /bin/ksh
set -x
num1=`echo 10.212.159.202 | cut -d"." -f1`
num2=`echo 10.212.159.202 | cut -d"." -f2`
num3=`echo 10.212.159.202 | cut -d"." -f3`
num4=`echo 10.212.159.202 | cut -d"." -f4`
#
for x in $num1 $num2 $num3 $num4
do
hex=`echo "obase=16;ibase=10; $x" | bc`
echo "$hex " >> iplog
done
nip=`cat iplog`
rm iplog
#

###### We've chosen 333 at random. 333 will be the row instance to use for this particular
###### ping experiment. After the ping, the row will be deleted.
###### This keeps the table clean. 10.212.159.202is the dns name of the device we are
###### working with, and RW is its RW community string. The values for
###### ciscoPingEntryStatus status are as follows (see Ping MIB):
###### 1 - active
###### 2 - notInService
###### 3 - notReady
###### 4 - createAndGo
###### 5 - createAndWait
###### 6 - destroy

###### We will clear out any previous entries by setting ciscoPingEntryStatus = 6 (destroy)
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.16.333 i 6

###### We start building the row by setting ciscoPingEntryStatus = 5 (createAndWait)
echo

snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.16.333 i 5

echo

echo "###### Now let's set the characteristics of the ping #######"
###### Only the first three sets below are REQUIRED. The rest have default
###### values.

#Set ciscoPingEntryOwner = any_name
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.15.333 s anyname

#Set ciscoPingProtocol = 1 = ip (see CISCO-TC-V1SMI.my CiscoNetworkProtocol)
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.2.333 i 1


#Set ciscoPingAddress = #.#.#.#--take Remote_Dest's ip & convert each octet to hex
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.3.333 x "A CE 2D FD"

#Set the packet count to 20 (ciscoPingPacketCount)
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.4.333 i 20

#Set the packetsize to 100 (ciscoPingPacketSize)
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.5.333 i 100
echo

echo "##### Now let's verify that the ping is ready to go and launch it #######"
#Get ciscoPingEntryStatus and make sure it is now equal to 2. This means
# notInService which indicates that we're ready to go.
snmpget -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.16.333

# Set ciscoPingEntryStatus = 1 to tell it to activate.
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.16.333 i 1

echo

echo "##### Let's look at the results. #####"
snmpwalk -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1

echo

echo "##### Now that we've gotten the results, let's destroy the row #####"
snmpset -c RW 10.212.159.202 .1.3.6.1.4.1.9.9.16.1.1.1.16.333 i 6


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top