11-20-2021 06:04 AM
Hi guys,
I need some help here, i am troubled by the way my eem applet always seems to add 2 lines to the output of the following applet outcome:
R1(config)#event manager applet test
R1(config-applet)#event none
R1(config-applet)#action 0010 cli command "enable"
R1(config-applet)#action 0011 puts ""
R1(config-applet)#action 0012 cli command "sh int desc | i 2000"
R1(config-applet)#action 0013 puts "$_cli_result"
R1(config-applet)#exit
R1(config)#end
R1#event manager run test
sh run int desc | i 2000
Fa0/0 up up --- TO BOKO657 & BHKG6568 VTI 2000
R1#
R1#sh int desc | i 2000
Fa0/0 up up --- TO BOKO657 & BHKG6568 VTI 2000
R1#---without eem i am right back at the prompt so only one line is the output of the sh int desc command
but when the applet is ran, i see 2 extra lines, one is the 'empty' router prompt line R1# and then there is another blank line following it and i want to get only the match line containing "2000"...how do i do this??
11-20-2021 11:45 AM
Hello,
put the keyword 'nonewline' before the 'puts':
event manager applet test
event none
action 0010 cli command "enable"
action 0011 puts ""
action 0012 cli command "sh int desc | i 2000"
action 0013 puts nonewline "$_cli_result"
11-21-2021 05:02 AM
Hi Georg,
Thanks for replying, that got one line out but, the "R1# prompt line" still is there, strange..is there an "enter" or carriage return hidden or something? How can i avoid that extra 'blank line' that is left as to only get the description line only as the output
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#event manager applet test
R1(config-applet)#event none
R1(config-applet)#action 0010 cli command "enable"
R1(config-applet)#action 0012 cli command "sh int desc | i 2000"
R1(config-applet)#action 0013 puts nonewline "$_cli_result"
R1(config-applet)#end
R1#
*Nov 21 13:52:27.895: %SYS-5-CONFIG_I: Configured from console by console
R1#event man
R1#event manager run test
Fa0/0 up up --- VTI 2000
R1#
R1#here its stopped
11-21-2021 08:45 AM
Hello,
when you run the applet, do you get the R1# prompt twice ?
R1#event manager run test
Fa0/0 up up --- VTI 2000
R1#
R1#here its stopped
I only get it once. Which IOS are you running, and on which device ?
11-21-2021 10:54 AM
Hi Georg,
note i removed hostname, this one still prints one extra line before returning to prompt
#conf t
Enter configuration commands, one per line. End with CNTL/Z.
(config)#event manager applet test
(config-applet)#event none
(config-applet)#action 0010 cli command "enable"
(config-applet)#action 0012 cli command "sh int desc | i 2000"
(config-applet)#action 0013 puts nonewline "$_cli_result"
(config-applet)#action 0014 exit
(config-applet)#end
event manager run test
Gi0/0/1 up up --- VTI 2000
#-----------------------this one still gets added for some reason---------------
#sh inv
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO: Please use "show license UDI" to get serial number for licensing.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
NAME: "Chassis", DESCR: "Cisco ISR4331 Chassis"
PID: ISR4331/K9 , VID: V04 , SN:
NAME: "Power Supply Module 0", DESCR: "250W AC Power Supply for Cisco ISR 4330"
psel30075#sh ver | i uni
System image file is "bootflash:isr4300-universalk9.16.12.04.SPA"
psel30075#
11-21-2021 01:18 PM
Hello,
odd, since I don't get that when I run the applet. The only difference is that I do not have action:
action 0014 exit
Try to run the applet without that line:
event manager applet test
event none
action 0010 cli command "enable"
action 0012 cli command "sh int desc | i 2000"
action 0013 puts nonewline "$_cli_result"
11-22-2021 05:28 AM
Hi Georg,
look i tried it on another chassis (without the exit command this time) but same result, i still got an extra line there (the router prompt line) :
event manager applet test
event none
action 0010 cli command "enable"
action 0011 puts ""
action 0012 cli command "sh int desc | i DSL"
action 0013 puts nonewline "$_cli_result"
!
end
router#event manager run test
Di1 up up --- Wan DSL Interface dialer
router#-------------------------------------where does this blank line come from?
router#here the applet stopped
router#sh int desc | i DSL
Di1 up up --- Wan DSL Interface dialer
router#here it stops when running the command without eem applet
router#sh inv | i chassis
NAME: "C881-K9", DESCR: "C881-K9 chassis, Hw Serial#: FCZ2208E0JV, Hw Revision: 1.0"
router#sh ver | i uni
System image file is "flash:c800-universalk9-mz.SPA.155-3.M6"
router#
11-22-2021 05:32 AM
Hello,
odd, as I don't get that extra line. I cannot test this on a real device right now, but try to add the 'end' action:
event manager applet test
event none
action 0010 cli command "enable"
action 0012 cli command "sh int desc | i 2000"
action 0013 puts nonewline "$_cli_result"
action 0014 end
11-22-2021 07:19 AM
Hi Georg,
When i do it like that the applet does not register due to:
*Nov 22 16:18:15.103: %HA_EM-6-FMPD_EEM_CONFIG: test: "end" action found outside of conditional block
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