03-14-2016 11:09 PM
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
03-15-2016 05:27 PM
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
03-15-2016 11:29 PM
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 :)
03-15-2016 11:35 PM
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.
03-15-2016 11:46 PM
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 :)
03-16-2016 03:29 PM
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.
06-07-2016 01:36 PM
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
06-07-2016 02:44 PM
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.
06-08-2016 06:12 AM
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 ...
11-20-2016 07:54 PM
Thanks Michel :)
Regards,
Jenish Nagoria
11-20-2016 07:54 PM
Thanks Joe :)
Regards,
Jenish Nagoria
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