07-22-2014 10:21 PM
Hi Everyone,
I'm new to EEM and was wondering if it would be possible to send 'show' commands (like 'show interface' or 'show crypto ipsec sa') to the terminal/console session after every, let's say, 10 minutes using watchdog timer. I know how to send it to the flash but would like to know if something of this sort is possible.
Any suggestions would be really appreciated!
Regards,
Nikhil
07-25-2014 12:00 AM
Hi Nithakur,
you can try the "action puts" from EEM
event manager applet SHOWI
event timer watchdog time 600
action 1.0 cli command "enable"
action 2.0 cli command "show int X/Y"
action 3.0 puts "$_cli_result"
for this to work, you would need to have "logging monitor informational" in your run and "terminal monitor" activated. The other option is to use IOS send command
event manager applet SHOWI2
event timer watchdog time 600
action 1.0 cli command "enable"
action 2.0 cli command "show int XY"
action 3.0 set A "$_cli_result"
action 4.0 cli command "send *" pattern "C:"
action 5.0 cli command "$A\032" pattern "confirm"
action 6.0 cli command "yes"
Note that the \032 is an equivalent for CTRL+Z (^Z) so after you configure it, you will see this line as
action 5.0 cli command "$A^Z" pattern "confirm"
in your ruiining config.
Regards,
Alex
08-03-2016 06:46 AM
Thanks Nikhil and Alex,
I found this and used it in a script to prevent my admins from inadvertently removing all the VLANs off a Trunk.
event manager applet forbid-vlan-trunk
event cli pattern "switchport trunk allowed vlan\s+[0-9]" sync no skip yes
action 1.0 syslog msg "switchport trunk allowed vlan MUST be configured via add/remove"
action 2.0 cli command "!switchport trunk allowed vlan MUST be configured via add/remove"
action 3.0 cli command "send *" pattern "/C:"
action 4.0 cli command "!switchport trunk allowed vlan MUST be configured via add/remove^Z" pattern "confirm"
action 5.0 cli command "yes"
!
got the idea from a post here http://networkengineering.stackexchange.com/questions/1190/accidentally-removed-allowed-vlans-from-cisco-switch-dot1q-trunk/1468#1468
Regards,
Karol
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: