03-02-2017 09:37 AM
Greetings,
I'm trying to configure an EEM script with an 'event of none', so that I can manually run the EEM script. I basically have the following script configured on a router.
event manager applet TSHOOT
event none
action 1.0 cli command "sh run | I LINK"
action 2.0 cli command "sh run | I LINE"
action 3.0 cli command "sh log | I Controller"
action 4.0 cli command "sh int x/x/x:0 | sec rate"
action 5.0 cli command "sh controller t1 x/x/x | I [1-9]"
I can go to Privileged Exec mode and type "event manager run TSHOOT", it accepts the command but nothing happens. I put the "event none", since it's not really waiting on a trigger, and so I can manually run it. Am I doing something wrong? I don't see any output at all from these commands after I run "event manager run TSHOOT".
03-03-2017 08:51 PM
EEM doesn't automatically run as a privileged user. Try adding:
action 0.5 cli command "enable"
Best to see exactly what it's doing though by running a debug (make sure you're logging buffer is set to debug level):
debug event manager action cli
03-04-2017 02:36 PM
Yes, enable is definitely needed, but EEM will also not print the results of the commands by default. You need to add something like the following between each cli action:
action 1.5 puts $_cli_result
09-03-2023 06:19 PM - edited 09-03-2023 06:20 PM
Hello Team, I think the method proposed by @thiland its very helpfully at least was tested by myself and results were good, below the example:
event manager applet TSHOOT2
event none
action 0.1 cli command "enable"
action 1.0 cli command "conf term"
action 2.0 cli command "int g0/1"
action 3.0 cli command "no shutdown"
action 4.0 cli command "end"
R1#event manager run TSHOOT2
R1#show log | inc TSHOOT2
Sep 4 00:55:35.539: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : CTL : cli_open called.
Sep 4 00:55:35.542: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1>
Sep 4 00:55:35.542: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : IN : R1>enable
Sep 4 00:55:35.552: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1#
Sep 4 00:55:35.552: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : IN : R1#conf term
Sep 4 00:55:35.562: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z.
Sep 4 00:55:35.563: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1(config)#
Sep 4 00:55:35.563: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : IN : R1(config)#int g0/1
Sep 4 00:55:35.573: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1(config-if)#
Sep 4 00:55:35.573: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : IN : R1(config-if)#no shutdown
Sep 4 00:55:35.718: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1(config-if)#
Sep 4 00:55:35.718: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : IN : R1(config-if)#end
Sep 4 00:55:35.721: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:TSHOOT2)
Sep 4 00:55:35.729: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : OUT : R1#
Sep 4 00:55:35.729: %HA_EM-6-LOG: TSHOOT2 : DEBUG(cli_lib) : : CTL : cli_close called.
Sep 4 01:13:52.008: %SYS-5-CONFIG_I: Configured from console by on vty0 (EEM:TSHOOT2)
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