cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1947
Views
15
Helpful
10
Replies

Unable to include Show command CLI syntax in output file via EEM

Jenish Nagoria
Level 1
Level 1

Hi Experts,

I am being trying to run EEM in my production environment for taking all the show command output periodically. But i am unable to get the command syntax along with the output. For a long list of show commands it is difficult to identify the output. 

I used "show Version | append ftp://Location" command in EEM script.

For example:- Below is the output from output file.

Actual Output:-

---------------------------------------------------------------------------------------

09:04:05.788 CST Fri Mar 11 2016

 

JKN12x01 uptime is 6 years, 39 weeks, 22 hours, 18 minutes

---------------------------------------------------------------------------------------

Expected Output:-

---------------------------------------------------------------------------------------

JKN12x01#sho clock

09:04:05.788 CST Fri Mar 11 2016

 

JKN12x01#sh version | in uptime

JKN12x01 uptime is 6 years, 39 weeks, 22 hours, 18 minutes

---------------------------------------------------------------------------------------

Please assist me in the above query.

 

Thanks in Advance :)

 

Regards,

Jenish Nagoria

10 Replies 10

Joe Clarke
Cisco Employee
Cisco Employee

You can only do this using applets if your device supports EEM 4.0.  In that case you can do:

file open fd "ftp://location" a

file puts fd "# show clock"

cli command "show clock"

puts fd "$_cli_result"

puts "# show version"

puts fd "$_cli_result"

...

file close fd

Hi Joe,

Thanks for your reply. I am using EEM basic version i.e 1.0. Is there any other way to add the syntax in output file. even apart from applet.

Thanks in advance :)

You can't be using EEM 1.0.  The cli action did not exist.  If you don't have EEM 4.0, then you will need to convert the applet to Tcl using http://www.marcuscom.com/convert_applet .  Then you can insert the code to be able to write directly to files.

Thanks Joe. I will be using the above link.

Can you please guide me in using the put commands, as i m not much familier with those commands.

Below is the script i m using.

action 1 cli command "enable"

action 2 cli command "terminal length 0"
action 3 cli command "show clock | append nvram:Test.txt"
action 4 cli command "sho ver | append nvram:Test.txt"

Thanks :)

Just create an applet using the actions I mentioned above and convert it to Tcl using the tool.  The resulting script policy will do what you want.

Joe , 

Doesn't work , I just convert the applet to tcl using the conversion tool that you previously mention .  see tcl attached. 

The error I'm getting is Command authorization failed in the Test.txt file append.

here some event manage tcl debugs :

Jun 7 20:33:57.597: [fh_tty_write_cmd] cmd = show clock | append flash1:Test.txt, cmdsize = 35
Jun 7 20:33:57.597: [fh_sys_reqinfo_routername_cmd]
Jun 7 20:33:57.706: [fh_tty_read_cmd]
Jun 7 20:33:57.706: [fh_tty_read_cmd] read not ready
Jun 7 20:33:57.807: [fh_tty_read_
Jun 7 20:33:57.807: [fh_tty_read_cmd] read not ready
Jun 7 20:33:57.907: [fh_tty_read_cmd]
Jun 7 20:33:57.907: [fh_tty_read_cmd] read not ready
Jun 7 20:33:58.008: [fh_tty_read_cmd]
Jun 7 20:33:58.008: [fh_tty_read_cmd] size= 19
Jun 7 20:33:58.008: [fh_tty_prompt_cmd]
Jun 7 20:33:58.117: [fh_cli_debug_cmd]
Jun 7 20:33:58.117: [fh_cli_debug_cmd]
Jun 7 20:33:58.117: [fh_tty_write_cmd]
Jun 7 20:33:58.117: [fh_tty_write_cmd] cmd = sho ver | append flash1:Test.txt, cmdsize = 32

Let me know if you find any solutions.

Thank you,

CDM

This has nothing to do with Tcl.  You need to configure "event manager session cli username USER" where USER is a user authorized to run all CLI commands within your EEM policies.

Joe, 

Now it is working after created the event manager user: 

Commands: event manager session cli username EEM

                     user name EEM privilage 15 secret ....

Thank you my friend ...

Thanks Michel :)

Regards,

Jenish Nagoria

Thanks Joe :) 

Regards,

Jenish Nagoria

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco