12-26-2018 02:36 PM
Hello,
I set up the following event script; its purpose is to run a ping and traceroute and save its output on text file, if a specific syslog message is triggered: "%TRACK-6-STATE: 16 ip sla 16 reachability Up -> Down"
event manager applet Test
event syslog pattern "%TRACK-6-STATE: 16 ip sla 16 reachability Up -> Down"
action 1.0 cli command "enable"
action 2.0 cli command "ping 8.8.8.8 source vlan 10 | append bootflash:/Test.txt"
action 2.1 cli command "traceroute 8.8.8.8 | append bootflash:/test"
action 2.2 cli command "exit"
Based on the syslog messages and event manager history, the event is triggered, but no textfile is stored on bootflash.
Model is WS-C4500X-3, Version 03.06.07.E
I would appreciate any advise on this issue.
Thanks,
Event Manager History
No. Job Id Proc Status Time of Event Event Type Name
:
10 423 Actv success Tue Dec25 09:17:34 2018 syslog applet: Test
Syslog:
12/25/2018 9:17:40 AM ---- 7259562: Dec 25 14:17:39.340: %TRACK-6-STATE: 16 ip sla 16 reachability Down -> Up 6 23
12/25/2018 9:17:35 AM ---- 7259561: Dec 25 14:17:34.339: %TRACK-6-STATE: 16 ip sla 16 reachability Up -> Down 6 23
12-26-2018 03:40 PM
12-30-2018 02:59 PM
Hello Larry,
Thank you for your reply.
I followed you advise, but unfortunately without any progress.
I successfully ran another simply EEM script:
event manager applet show-clock
event timer watchdog name timer time 30
action 0.25 cli command "enable"
action 0.5 cli command "show clock | append bootflash:/clock.txt"
action 1.0 cli command "exit"
!
48490 -rw- 175 Dec 30 2018 17:18:50 -05:00 clock.txt
And it was working fine.
Apparently, there is an issue with the cli traceroute command in association with "append":
while the show commands seems to support the "append" option, it seems not to be the case with commands, such as traceroute or ping:
RTR#show clock | append ?
bootflash: Uniform Resource Locator
cat4000_flash: Uniform Resource Locator
ftp: Uniform Resource Locator
http: Uniform Resource Locator
:
RTR#traceroute 8.8.8.8 | ?
% Unrecognized command
Therefore, I was wondering on what type of Cisco device/IOS your EEM scripts are running?
Thanks,
.
01-02-2019 09:03 AM - edited 01-02-2019 11:02 AM
Hi,
We run ours on 4300/4400 series and ASR1000 series routers. Example below.
event manager applet EMAIL-DOWN authorization bypass
event track 11 state down
trigger delay 10
action 1.0 cli command "enable"
action 2.0 cli command "terminal length 0"
action 2.5 cli command "del /force flash:output.txt"
action 3.0 cli command "sh ip sla stat 11 | redirect bootflash:output.txt"
action 3.1 cli command "sh ip sla stat 991 | append bootflash:output.txt"
action 4.0 cli command "sh ip route x.x.x.x | append bootflash:output.txt"
action 4.1 cli command "sh ip route x.x.x.x | append bootflash:output.txt"
action 5.0 cli command "more flash:output.txt"
action 6.0 mail server "x.x.x.x" to "e-maill address" from "sending email address" subject "subject" body "$_cli_result" source-address x.x.x.x
action 7.0 cli command "del /force flash:output.txt"
action 8.0 cli command "conf t"
action 9.0 cli command "no track 11 ip sla 11"
01-03-2019 12:01 PM
Thank you Larry.
Show commands seems to be supported in association with "pipe append" while commands like traceroute and ping seem not to be provided in Cisco IOS XE; please see debug below.
Hence, I assume that I have to create a TCL script in order to capture the traceroute output on text file.
I found a similar discussion about TCLscripts at https://community.cisco.com/t5/network-management/tcl-script-for-traceroute/td-p/3002966.
***********************************************************************
Jan 2 20:48:26.402: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT :
Jan 2 20:48:26.402: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : RTR>
Jan 2 20:48:26.402: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : RTR>enable
Jan 2 20:48:26.421: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : RTR#
Jan 2 20:48:26.421: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : RTR#traceroute 8.8.8.8 | append bootflash:/traceroute.txt
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : traceroute 8.8.8.8 | append bootflash:/traceroute.txt
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : ^
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : % Invalid input detected at '^' marker.
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT :
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : RTR#
Jan 2 20:48:26.533: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : IN : RTR#exit
Jan 2 20:48:26.543: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : OUT : RTR>
Jan 2 20:48:26.543: %HA_EM-6-LOG: test : DEBUG(cli_lib) : : CTL : cli_close called.
Jan 2 20:48:26.544:
Jan 2 20:48:26.544: tty is now going through its death sequence
01-03-2019 12:10 PM
05-01-2019 03:34 PM
did you make this work ?
If its working could you please share the script ?
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