I will say it is easier to do with Expect.
This URL gives you the steps necessary to do it.
http://www.cisco.com/web/about/security/intelligence/embedded-event-mgr.html
The example "Threshold Based Logging for ACL-Dropped Packets" is essentially
what you are trying to do. Capture output. Compare it; and take an action
if it is matched. You can work thru it or I can help you as well if you
have questions on it.
Regards,
Tyson Scott - CCIE #13513 R&S, Security, and SP
Managing Partner / Sr. Instructor - IPexpert, Inc.
Mailto: <mailto:tscott_at_ipexpert.com> tscott_at_ipexpert.com
Telephone: +1.810.326.1444, ext. 208
Live Assistance, Please visit: <http://www.ipexpert.com/chat>
www.ipexpert.com/chat
eFax: +1.810.454.0130
IPexpert is a premier provider of Self-Study Workbooks, Video on Demand,
Audio Tools, Online Hardware Rental and Classroom Training for the Cisco
CCIE (R&S, Voice, Security & Service Provider) certification(s) with
training locations throughout the United States, Europe, South Asia and
Australia. Be sure to visit our online communities at
<http://www.ipexpert.com/communities> www.ipexpert.com/communities and our
public website at <http://www.ipexpert.com/> www.ipexpert.com
From: Mohamed Osama [mailto:tetoo_me_at_hotmail.com]
Sent: Tuesday, February 08, 2011 2:06 PM
To: tscott_at_ipexpert.com; Cisco certification; markom_at_ipexpert.com
Subject: RE: EEM Applet
Dear Tyson,
Thanks for sharing your Idea and I'm here Waiting for your Test
Results,because that scenario really makes me crazy and i need to solve it
as soon as possible :( due to the lack of keepalives end - to - end.
Thanks,
_____
From: tscott_at_ipexpert.com
To: tetoo_me_at_hotmail.com; ccielab_at_groupstudy.com; markom_at_ipexpert.com
Subject: RE: EEM Applet
Date: Tue, 8 Feb 2011 13:43:07 -0500
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 - 14:13:01 ART
This archive was generated by hypermail 2.2.0 : Tue Mar 01 2011 - 07:01:50 ART