ā03-25-2016 06:04 AM
When you call an action cli in EEM , the output generated from the last cli command is stored in the variable $_cli_result, the issue is this is overwritten each time action cli is written.
So if I have two cli commands I want the output for ( i've made the event a config change so its easier to test)
event manager applet mail_cfg_chg
event syslog pattern ".*%SYS-5-CONFIG_I.*"
action 1.0 info type routername
action 1.1 cli command "enable"
action 1.2 cli command "show ip bgp sum | append cat4000_flash:test.txt"
action 1.3 cli command "show ip int brief | append cat4000_flash:test.txt"
action 1.4 syslog msg "*** BGP and int Brief ***"
action 1.6 cli command "more cat4000_flash:test.txt"
action 1.8 syslog msg "*** test log ***"
action 1.9 mail server "$_Email_Server" to "$_Email_To" from "$_Email_From" subject ": $_info_routername" body "$_cli_result"
!
I've tried to do this by appending to a new file in a valid new file in the flash , append output to that file and then call the output afterwards.
I get the following error
%Error opening cat4000_flash:test.txt (No such file or directory)
I can't seem to see how to create a txt file , any suggestions?
ā03-25-2016 01:32 PM
Chances are the cat4000_flash: file system does not support "append". You can test this by running those commands manually.
If you need to get the output of two commands, use the append action:
action 1.11 set result ""
action 1.21 append result $_cli_result
action 1.31 append result $_cli_result
Then use $result. This requires EEM 3.0 or higher.
ā06-15-2022 01:47 PM
is it possible to call _cli_result in one of the action cli commands?
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