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

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

Cisco Employee

Sending 'show' command outputs to console/terminal using EEM

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

2 REPLIES
New Member

Hi Nithakur, you can try the

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

New Member

Thanks Nikhil and Alex,

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

694
Views
5
Helpful
2
Replies