cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1781
Views
0
Helpful
2
Replies

Cisco EEM Multiple Events

csco10675262
Level 1
Level 1

Hi,

I would like to check if it may be possible to have the following scenarios for EEM:

 

a. Port A is down and port B is up  --> Shutdown port C

B. Port B is down and port A is up --> Shutdown port D

C. Port A is down and Port B is down --> port C and Port D interfaces is to be UP

 

Appreciate for any suggestions :)

 

Thanks.

1 Accepted Solution

Accepted Solutions

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Yes it is possible.

 

you will need to regex sh ip int br | inc <interface_XX> for the occurrence of for example  "up\s*up" for an interface which is UP. You are not interested in the match that the regex returns, instead the result, ie a 1 means it matches. You can then use this in an if statement.

 

I'm not in a position to test this, but something like :

!
...
 action 01 clie command "enable"
 action 03 cli command "sh int br | inc gi0/1"
 action 04 regexp "up\s*up" "$_cli_result""
 action 06 if $_regexp_result eq "1"
 action 07  syslog msg "Gi0/1 is up!!"
 action 08  cli command "conf t"
 action 09  cli command "int gi0/10"
 action 10  cli command "shut"
 action 11  cli command "exit"
...
!

cheers, 

Seb.

View solution in original post

2 Replies 2

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Yes it is possible.

 

you will need to regex sh ip int br | inc <interface_XX> for the occurrence of for example  "up\s*up" for an interface which is UP. You are not interested in the match that the regex returns, instead the result, ie a 1 means it matches. You can then use this in an if statement.

 

I'm not in a position to test this, but something like :

!
...
 action 01 clie command "enable"
 action 03 cli command "sh int br | inc gi0/1"
 action 04 regexp "up\s*up" "$_cli_result""
 action 06 if $_regexp_result eq "1"
 action 07  syslog msg "Gi0/1 is up!!"
 action 08  cli command "conf t"
 action 09  cli command "int gi0/10"
 action 10  cli command "shut"
 action 11  cli command "exit"
...
!

cheers, 

Seb.

Thank you for the information! :)