08-18-2021 01:52 AM - edited 08-18-2021 01:57 AM
I have the following event applet to trace and ping to peer address and save the result to a TXT file. It doesn't work properly in the exported file. It doesn't traceroute each time, and never ping in debug view. Could anyone can tell me what was wrong?
My device is ASR1001X, version 16.12.4
event manager applet Trace-CN-SJ
description "Run a command per minute in working time"
event timer cron cron-entry "*/1 8-18 * * 1-5"
action 1.1 cli command "enable"
action 1.2 cli command "show clock | append bootflash:/trace-hub3-sj.txt"
action 1.3 cli command "traceroute ip 207.223.104.221 source 123.168.4.114 probe 5 numeric"
action 1.4 file open fd trace-hub3-sj.txt a+
action 1.5 file write fd "$_cli_result"
action 1.6 cli command "ping 207.223.104.221 source 123.168.4.114 repeat 100"
action 1.7 file write fd "$_cli_result"
action 1.8 file close fd
*******************
below is a part of exported txt file:
*******************
HUB3#more bootflash:trace-hub3-sj.txt
08:00:00.178 UTC Wed Aug 18 2021
08:01:00.164 UTC Wed Aug 18 2021
Type escape sequence to abort.
Tracing the route to 207.223.104.221
VRF info: (vrf in name/id, vrf out name/id)
1 123.168.4.113 1 msec 2 msec 1 msec 1 msec 1 msec
2 60.235.29.153 [AS 65522] 1 msec
222.173.65.81 [AS 65522] 3 msec
60.235.29.153 [AS 65522] 2 msec 1 msec 1 msec
3 59.43.199.125 [AS 65522] 1 msec 1 msec 1 msec 1 msec 1 msec
4 59.43.122.33 [AS 65522] 6 msec
59.43.122.57 [AS 65522] 9 msec
59.43.122.33 [AS 65522] 6 msec
!*********output omitted*************
08:03:00.166 UTC Wed Aug 18 2021
08:04:00.172 UTC Wed Aug 18 2021
08:05:00.173 UTC Wed Aug 18 2021
***********debug information*************
Aug 18 06:33:00.002: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : CTL : cli_open called.
Aug 18 06:33:00.102: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : OUT : HUB3>
Aug 18 06:33:00.102: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : IN : HUB3>enable
Aug 18 14:33:00.107: %PARSER-5-CFGLOG_LOGGEDCMD: User:unknown user logged command:!exec: enable
Aug 18 06:33:00.113: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : OUT : HUB3#
Aug 18 06:33:00.113: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : IN : HUB3#show clock | append bootflash:/trace-qdhub3cn2-sj.txt
Aug 18 06:33:00.224: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : OUT : HUB3#
Aug 18 06:33:00.224: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : IN : HUB3#ping 207.223.104.221 source 123.168.4.114 repeat 100
Aug 18 06:33:20.054: %HA_EM-6-LOG: Trace-CN-SJ : DEBUG(cli_lib) : : CTL : cli_close called.
Aug 18 06:33:20.054:
Aug 18 06:33:20.054: tty is now going through its death sequence
Solved! Go to Solution.
08-18-2021 09:05 AM
Your applet is running out of time. EEM policies have a default maxrun of 20 seconds, which could easily be exhausted by that ping. To ensure that this whole thing will complete, even when everything fails, you likely want a maxrun of 860. But that will completely overrun your cron schedule. So if you anticipate that this should mostly work, go with the maximum amount of time you can fit between executions, which is 60 seconds. Your ping (and traceroute for that matter) can still fail, but in a mostly healthy case, both commands should complete within a minute.
Alternatively, back off your run time to every five minutes, and then increase maxrun to 300.
08-18-2021 09:05 AM
Your applet is running out of time. EEM policies have a default maxrun of 20 seconds, which could easily be exhausted by that ping. To ensure that this whole thing will complete, even when everything fails, you likely want a maxrun of 860. But that will completely overrun your cron schedule. So if you anticipate that this should mostly work, go with the maximum amount of time you can fit between executions, which is 60 seconds. Your ping (and traceroute for that matter) can still fail, but in a mostly healthy case, both commands should complete within a minute.
Alternatively, back off your run time to every five minutes, and then increase maxrun to 300.
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