Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Interface shut/no shut using ip sla with EEM applet

Hi,

I have to come up with a script to 'shut' a particular interface on a router (3945E running IOS 15.0) when a link goes down and also to 'no shut' it after the link comes back up. This is what I have so far.

track 1 ip sla 10 reachability

delay down 10 up 10

!

ip sla 10

icmp-echo 192.168.0.1 source-interface GigabitEthernet 0/1

frequency 30

ip sla schedule 10 life forever start-time now

!

event manager applet Link-Down

event track 1 state down

action 1.0 syslog msg "Reply timed out; Link is down"

action 1.1 cli command "enable"

action 1.2 cli command "conf t"

action 1.3 cli command "interface g0/0"

action 1.4 cli command "shut"

action 1.5 cli command "end"

action 1.6 syslog msg "Interface GigabitEthernet 0/1 shutdown"

event manager applet Link-Up

event track 1 state up

action 1.0 syslog msg "Ping received; Link is up"

action 1.1 cli command "enable"

action 1.2 cli command "conf t"

action 1.3 cli command "interface g0/0"

action 1.4 cli command "no shut"

action 1.5 cli command "end"

action 1.6 syslog msg "Interface GigabitEthernet 0/1 up"

I have to go to a remote site and get this working within a short maintenance window but unfortunately I have no way of testing it out and I dont want to go in blind. So, if someone could verify that the script will work with my IOS version, that'll be great.

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Interface shut/no shut using ip sla with EEM applet

This will work, but your syslog message seems to indicate that the wrong interface is being shutdown.  You may also need "event manager session cli username USER" if your router uses AAA command authorization.

2 REPLIES
Cisco Employee

Interface shut/no shut using ip sla with EEM applet

This will work, but your syslog message seems to indicate that the wrong interface is being shutdown.  You may also need "event manager session cli username USER" if your router uses AAA command authorization.

Community Member

Interface shut/no shut using ip sla with EEM applet

Woops, yeah should be g0/0 in the syslog msg also. Thx Joseph!

2764
Views
0
Helpful
2
Replies
CreatePlease to create content