I will test to see if I can find a way to do this, this is interesting to
me. I am not sure without testing, I will get back when/if I figure it out.
To give some ideas this is how you could do it with expect.
set down_count 0
set receive_count 0
while { $down_count == 0 } {
send "show mpls l2transport vc 10 detail\r"
expect "show mpls l2transport vc 10 detail"
expect {
-re "receive \(\[0-9]+\)," {
set string1
$expect_out(1,string)
if { [ string match "$string1"
"$receive_count" ] } { set down_count 1 } else { set receive_count
"$string1"; sleep 5 }
}
}
}
send "configure terminal\r"
expect "configure terminal"
send "interface FastEthernet0/0.10\r"
expect "interface FastEthernet0/0.10"
send "shutdown\r"
expect "shutdown"
exec echo "SCRIPT Shutdown FastEthernet0/0.10 on RouterX. Please solve the
problem and restart the script" | /bin/mail -s "FAILURE DETECTED"
tetoo_me_at_hotmail.com
exit 1
Expect is built on TCL which is what we use in IOS. If it is possible to do
this same thing with EEM, which I am just not sure about, you would need to
combine a TCL script with EEM to perform your function. But I would be
nervous doing EEM like this in production. I would be nervous about it
being caught in a loop and hogging resources.
Regards,
Tyson Scott - CCIE #13513 R&S, Security, and SP
Managing Partner / Sr. Instructor - IPexpert, Inc.
Mailto: tscott_at_ipexpert.com
From: Mohamed Osama [mailto:tetoo_me_at_hotmail.com]
Sent: Tuesday, February 08, 2011 11:31 AM
To: Cisco certification; markom_at_ipexpert.com; tscott_at_ipexpert.com
Subject: OT : EEM Applet
Dear all,
Sorry for this,but I need to Configure a Complicate Embedded Event Manager
Script that doing the Following :
First issue the below Command :
NewYork#show mpls l2transport vc 10 detail
Local interface: FastEternet0/0.10 up, line protocol up, Eth VLAN 10 up
Destination address: 192.168.1.102, VC ID: 10, VC status:up
Tunnel label: not ready
Create time: 22:31:53, last status change time: 04:02:56
Signaling protocol: LDP, peer 192.168.1.102:0 up
VC statistics:
packet totals: receive 1650, send 1743
byte totals: receive 552557, send 550044
packet drops: receive 0, send 7
Then Look at Packet totals : receive 1650 , and checks it Value using Logic
loop or something,
If EEM find receive value is the same which means we didn't recive any
Packets which mean for me the Link is broken
Then do the Following Action : shutdown int fa0/2.3 as Example ,so we
terminate the Link and the other end of the tunnel
can know that we are not connected anymore to the Customer Device.
Can anyone help me with this please?I need to the Logical Sequence to do it
and Logical Mathematical sentence
for checking Receive parameter?
Blogs and organic groups at http://www.ccie.net
Received on Tue Feb 08 2011 - 13:43:07 ART
This archive was generated by hypermail 2.2.0 : Tue Mar 01 2011 - 07:01:50 ART