cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2134
Views
0
Helpful
1
Replies

Need to add some if then and set a check in EEM script

kevin.king
Level 1
Level 1

OK the below script watches errors on a path. When it crosses the thresshold it sends a trap and changed the netmask on the path to prevent the route to the far node being used. on so this network is built as two seperate networks. For this lets call them network "A" and "B". the two networks do not touch. Even the OAM network to the router is on seperate vlans. so the chalange is to add inteligence to the script to not run if the router on the "B" network with this same script has dissabled the route so we do not end up with the "A" & "B" network isolated at the same time.

Yes I can think of many other ways to do this, but this is what is in place.  So how would I set a varible or some flag that I could check to make sure an event has not taken the other path down?  Checking for a file or something on a remote box is my first thought. Anyway I am tossing this out to see what some fresh minds might come up with.

event manager applet SNMP_RTT_Vlan1560_High-Delay

event snmp oid "rttMonLatestJitterOperRTTSum.15600" get-type exact entry-op ge entry-val "1500" entry-type value poll-interval 5 maxrun 180

action 10.0 snmp-trap intdata1 100 intdata2 200 strdata " ***HIGH PACKET DELAY Linkset SHUTDOWN*** some route >some other route Vlan1560"

action 10.5 syslog msg "****EEM Interface SHUTDOWN-HIGH DELAY to re-enable change interface Vlan1560 ip address 10.224.159.233 255.255.255.248 **** description some route>some other route"

action 100.0 cli command "enable"

action 110.0 cli command "config terminal"

action 130.0 cli command "interface Vlan1560"

action 140.0 cli command "ip address 10.224.159.233 255.255.255.254"

action 145.0 cli command "description ****EEM Interface SHUTDOWN-HIGH DELAY to re-enable change interface Vlan1560 ip address 10.224.159.233 255.255.255.248 **** description some route > some other route"

action 180.0 cli command "no event manager applet SNMP_RTT_Vlan1560_High-Delay_Routing_Restore"

action 200.0 cli command "event manager applet SNMP_RTT_Vlan1560_High-Delay_Routing_Restore"

action 205.0 cli command "event timer countdown time 95 name Restore_timer_Vlan1560 maxrun 180"

action 210.0 cli command "action 100.0 cli command $QUOTE enable $QUOTE "

action 220.0 cli command "action 110.0 cli command $QUOTE config terminal $QUOTE "

action 230.0 cli command "action 130.0 cli command $QUOTE interface Vlan1560 $QUOTE "

action 240.0 cli command "action 140.0 cli command $QUOTE ip address 10.224.159.233 255.255.255.248 $QUOTE "

action 250.0 cli command "action 145.0 cli command $QUOTE description Some route  > some other route $QUOTE "

action 260.0 cli command "action 150.0 cli command $QUOTE end $QUOTE "

action 280.0 cli command "action 170.0 snmp-trap intdata1 100 intdata2 200 strdata $QUOTE ***High packet delay Linkset RESTORED *** some route > someother route $QUOTE "

action 290.0 cli command "action 180.0 syslog msg $QUOTE ****EEM RESTORED**** interface Vlan1560 IP address 10.224.159.233 255.255.255.248 description some route>some other route $QUOTE "

action 400.0 cli command "end"

action 410.0 cli command "disable"

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

You could have the remote box send this box a trap that another EEM applet detects then creates a local environment variable that prevents the local router from executing this SNMP policy.  See https://supportforums.cisco.com/docs/DOC-11745 on how to create a customized trap.  The snmp-notification event detector can be used to detect this trap.

Review Cisco Networking for a $25 gift card