cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1770
Views
5
Helpful
6
Replies

Is ping supported yet? ETA?

jacob6000
Level 1
Level 1

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"

 

1 Accepted Solution

Accepted Solutions

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

 

View solution in original post

6 Replies 6

ghostinthenet
Level 7
Level 7

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.

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?
 

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

 

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"

Your syntax is different from my post.  

Yes, I corrected it. Thank you very much.

Review Cisco Networking for a $25 gift card