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

New to EEM Scripting

screenshotjy
Level 1
Level 1

Hey I'm having trouble doing the basic scripting using EEM CLI. I have been playing around with seemingly easy script but for some reason my show commands are not displaying on the terminal. However, when I turned on the event manager debugging tool. I see the output there. Am I missing something blaringly obvious right now?

Here is my script

Switch#show event manager policy registered

No.  Class     Type    Event Type          Trap  Time Registered           Name

1    applet    user    none                Off   Mon Mar 1 00:05:33 1993   show-applet

policyname {show-applet} sync {yes}

maxrun 20.000

action 1.0 cli command "enable"

action 2.0 cli command "show running-config"

Here is the debugging output

*Mar  1 00:25:08.556: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : CTL : cli_open called.

*Mar  1 00:25:08.556: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : Switch>

*Mar  1 00:25:08.556: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : IN  : Switch>enable

*Mar  1 00:25:08.573: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : Switch#

*Mar  1 00:25:08.573: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : IN  : Switch#show running-config

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : Building configuration...

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT :

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : Current configuration : 1051 bytes

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : ! Last configuration change at 00:24:43 UTC Mon Mar 1 1993

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : version 15.0

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : no service pad

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : service timestamps debug datetime msec

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : service timestamps log datetime msec

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : no service password-encryption

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : hostname Switch

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : boot-start-marker

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : boot-end-marker

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : !

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : no aaa new-model

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : OUT : system mtu routing 1500

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : CTL : 20+ lines read from cli, debug output truncated

*Mar  1 00:25:09.135: %HA_EM-6-LOG: show-applet : DEBUG(cli_lib) : : CTL : cli_close called.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

All CLI commands execute in a separate VTY session, so you won't immediately see the output.  Assuming you have EEM 3.0 or higher, add:

action 3.0 puts $_cli_result

The $_cli_result variable will always hold the results of the last CLI command executed.

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

All CLI commands execute in a separate VTY session, so you won't immediately see the output.  Assuming you have EEM 3.0 or higher, add:

action 3.0 puts $_cli_result

The $_cli_result variable will always hold the results of the last CLI command executed.

screenshotjy
Level 1
Level 1

Thanks for the information. That really helped me out

Review Cisco Networking for a $25 gift card