11-20-2014 11:51 AM
Is ping supported yet or is it planned? I want to be able to add it like this:
action 1.1 cli command "enable"
action 1.2 cli command "del /force flash:diag_checks"
action 1.3 cli command "ping 10.10.10.10"
Solved! Go to Solution.
11-22-2014 06:34 PM
There is a variable called $_cli_result that holds the response from the last CLI command executed. This applet will place the ping response in a file called diagresult
action 010 cli command "enable"
action 020 cli command "ping 192.168.0.125"
action 030 file open diagresult flash:diagresult a+
action 040 file write diagresult "$_cli_result"
action 050 file close diagresult
11-20-2014 05:37 PM
Ping works just fine in EEM. Using your applet, I get this:
edge#debug event manager action cli Debug EEM action cli debugging is on edge#event manager run test 003408: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : CTL : cli_open called. 003409: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : edge> 003410: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : edge>enable 003411: Nov 20 2014 20:35:49 EST: %PARSER-5-CFGLOG_LOGGEDCMD: User:unknown user logged command:!exec: enable 003412: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : edge# 003413: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : edge#del /force flash:diag_checks 003414: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : %Error deleting flash:diag_checks (File not found) 003415: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : edge# 003416: Nov 20 2014 20:35:49 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : edge#ping 10.10.10.10 edge# 003417: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : Type escape sequence to abort. 003418: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : Sending 5, 100-byte ICMP Echos to 10.10.10.10, timeout is 2 seconds: 003419: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : ..... 003420: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : Success rate is 0 percent (0/5) 003421: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : edge# 003422: Nov 20 2014 20:35:59 EST: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : CTL : cli_close called.
What IOS version are you running? I'm doing this with 15.1.4M8.
11-21-2014 03:11 PM
Ahh, let me correct myself. Ping is working. I just can't get the output to be scraped along with everything else.
ex: This works:
action 1.0 cli command "show clock | append diag_results.txt
This does not work with ping:
action 1.1 cli command "ping 10.10.10.10 | diag_results"
I need the results in the email. I get everything for my show commands but not the ping. How do I grab the ping response data?
11-22-2014 06:34 PM
There is a variable called $_cli_result that holds the response from the last CLI command executed. This applet will place the ping response in a file called diagresult
action 010 cli command "enable"
action 020 cli command "ping 192.168.0.125"
action 030 file open diagresult flash:diagresult a+
action 040 file write diagresult "$_cli_result"
action 050 file close diagresult
11-23-2014 12:43 PM
This is great info Daniel. It looks like my current version doesn't support all the file options.
router(config-applet)#action 1.4 cli command file ?
pattern response pattern
<cr>
router(config-applet)#
How can I make it work with this snippet:
event manager applet eem test
event none
action 1.0 syslog msg "EEM Test failed"
action 1.1 cli command "enable"
action 1.2 cli command "ping 10.10.10.10.10"
action 1.3 append $_cli_result "daig_results"
11-23-2014 03:52 PM
Your syntax is different from my post.
11-23-2014 07:29 PM
Yes, I corrected it. Thank you very much.
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