cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
548
Views
3
Helpful
16
Replies

EEM scripting help

Sunny5
Level 1
Level 1

I'm trying to have EEM script where I run the script manually and it display the output of the results in the session but for some reason I'm unable to do so. This is what I have so far


(config)#event manager applet TestCommand
(config-applet)# event none 
(config-applet)# action 1.0 cli command "show version"
(config-applet)# action 2.0 puts "$_cli_result"
(config-applet)#end

 

When I do "event manager run TestCommand" it shows a blank output with no results. 

1 Accepted Solution

Accepted Solutions

Sunny5
Level 1
Level 1

i found my solution for this, i had to put single quotations around $_cli_result to get this to work

event manager applet TestCommand
event none
action 1.0 cli command "enable"
action 2.0 cli command "show version"
action 3.0 puts '$_cli_result'

View solution in original post

16 Replies 16

Hello,

it looks like you need to add the 'enable' command:

(config)#event manager applet TestCommand
(config-applet)# event none
(config-applet)# action 1.0 cli command "enable"
(config-applet)# action 2.0 cli command "show version"
(config-applet)# action 3.0 puts "$_cli_result"
(config-applet)#end

Sunny5_0-1713530664084.png

this was my result when i ran it

debug event manager all

Share output of this 

MHM 

When I did this and ran the event manager run TestCommand, I didn't see any output for the debug

Hello,

post the running configuration (sh run) of the device you have installed the EEM script on...

correct command is below

MHM

Sunny5_1-1713794425488.png

this was my result

here is what i have in my show run

Sunny5_2-1713794657076.png

 

 

 

I'm not sure why the $_cli_result command doesnt show

 

Sunny5_3-1713794723341.png

this is what I entered



 

 

Friend the correct command in yellow'

You need to config 

Puts $_cli_result

Without any " inbetween

Check yellow command I share

MHM

sorry, are you asking to have it be like:

event manager applet TestCommand
event none
action 1.0 cli command "enable"
action 2.0 cli command "show version"
action 3.0 puts $_cli_result


the action 3.0 line would get me a incomplete command

 

Screenshot (339).pngScreenshot (340).png

it work in my lab 

do space between word puts and $_cli_result

MHM

yep, I have a space in between puts and the $_cli_result, I'm not sure why its being considered a incomplete command

Sunny5_1-1713797061904.png

 

Ok' 

Use new event manager with new name 

And use "" for puts command 

And check result when you run it manually 

MHM

this is what I've entered

Sunny5_0-1713797657376.png

And this was my result (same as previous)

Sunny5_2-1713797736616.png

 

 

Hello,

odd indeed. I would delete all EEM scripts, reboot the router, and enter the script again...