21 May, 2015

EEM Script

! Sends ping every 20 Sec and restarts "Job".

event manager applet TEST
event timer countdown time 20
 action 1.0 cli command "enable"
 action 2.0 cli command "ping 10.10.10.2 source 10.10.10.1 repeat 1"
 action 3.0 cli command "configure terminal"
 action 4.0 cli command "event manager applet TEST"
 action 5.0 cli command "event timer countdown time 20"
 action 6.0 cli command "exit"

! 48 Hours = 172800 Sec

! Show Job History 
R1#show event manager history events
No.  Job Id Proc Status   Time of Event            Event Type        Name
1    35     Actv abort    Wed May13 12:59:25 2015  timer countdown   applet: TEST
2    36     Actv abort    Wed May13 12:59:45 2015  timer countdown   applet: TEST
3    37     Actv abort    Wed May13 13:00:06 2015  timer countdown   applet: TEST
4    38     Actv abort    Wed May13 13:00:27 2015  timer countdown   applet: TEST
5    39     Actv abort    Wed May13 13:00:47 2015  timer countdown   applet: TEST
6    40     Actv abort    Wed May13 13:01:08 2015  timer countdown   applet: TEST
7    41     Actv abort    Wed May13 13:01:28 2015  timer countdown   applet: TEST
8    42     Actv abort    Wed May13 13:01:48 2015  timer countdown   applet: TEST
9    43     Actv abort    Wed May13 13:02:11 2015  timer countdown   applet: TEST
10   44     Actv abort    Wed May13 13:02:32 2015  timer countdown   applet: TEST


! Debug TEST
R1# debug event manager action cli

*May 13 13:04:35.171: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : CTL : cli_open called.
*May 13 13:04:35.183: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1>
*May 13 13:04:35.187: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R1>enable
*May 13 13:04:35.207: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1#
*May 13 13:04:35.211: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R1#ping 10.10.10.2 source 10.10.10.1 repeat 1
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Type escape sequence to abort.
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Sending 1, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Packet sent with a source address of 10.10.10.1
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : !
R1#y 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Success rate is 100 percent (1/1), round-trip min/avg/max = 40/40/40 ms
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1#
*May 13 13:04:35.331: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R1#configure terminal
*May 13 13:04:35.451: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line.  End with CNTL/Z.
*May 13 13:04:35.451: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1(config)#
*May 13 13:04:35.455: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R1(config)#event manager applet TEST
*May 13 13:04:35.575: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1(config-applet)#
*May 13 13:04:35.575: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : IN  : R1(config-applet)#event timer countdown time 20
*May 13 13:04:35.707: %HA_EM-6-LOG: TEST : DEBUG(cli_lib) : : OUT : R1(config-applet)#