08-07-2019 02:40 AM
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.
Solved! Go to Solution.
08-07-2019 08:02 AM
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.
08-07-2019 08:02 AM
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.
08-07-2019 10:25 PM
Thank you for the information! :)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide