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

EEM SCRIPT- HELP. CHECK THE INTERFACE STATUS BEFORE EXECUTING CLI

NAGA1
Level 1
Level 1

track 1 ip sla 1 reachability

!

track 2 ip sla 2 reachability

!

track 10 interface TenGigabitEthernet0/0/0 line-protocol

!

track 12 list boolean or

object 1

object 2

 

event manager session cli username "EEM"

event manager applet SHUT_IF authorization bypass

event track 12 state down

               

Below commands should not executed if the interface TenGigabitEthernet0/0/0 was already down”. The below commands should work only if the interface is UP.

 

action 1.0 cli command "enable"

action 2.0 cli command "conf t"

action 3.0 cli command "interface TenGigabitEthernet0/0/0"

action 4.0 cli command "shut"

action 5.0 cli command "end"

 

1 Reply 1

Hello,

 

the applet below would be a simpler way to accomplish what you want. The applet would run every 60 seconds, you can change that value if needed:

 

event manager applet INTERFACE_STATUS_DOWN
event timer watchdog time 60
action 1.0 cli command "enable"
action 2.0 cli command "show interfaces TenGigabitEthernet0/0/0"
action 3.0 string match "*up*" "$_cli_result"
action 4.0 if $_string_result eq "1"
action 5.0 cli command "conf t"
action 6.0 cli command "interface TenGigabitEthernet0/0/0"
action 7.0 cli command "shut"
action 8.0 end

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card