07-01-2010 07:53 AM
I am using the EEM to archive the router's configuration and other log to my SCP server on a daily basic. The SCP server is hosted on a Windows server environment. When archive or copy manually to the SCP server, it takes around 10 sec to authenticate and for the copy process to complete. It seems that the EEM applet timeout during the process and stop in the middle. I also want to put the current date (YYYYMMDD) in the dailylog file name. Below is my configuration and the log of the debug event manager action cli.
ACMGJC_Router1#sh run | sec event manager
event manager applet DailyArchive
event none
action 1.0 cli command "enable"
action 2.0 cli command "show process cpu history | redirect flash:/dailylog"
action 2.1 cli command "show interface fastethernet 0/0 | append flash:/dailylog"
action 2.2 cli command "show interface fastethernet 0/1 | append flash:/dailylog"
action 2.3 cli command "show ip nat translations | append flash:/dailylog"
action 2.4 cli command "copy flash:/dailylog scp://username:password@SCP IP/DailyLog" pattern "SCP IP"
action 2.5 cli command "SCP IP" pattern "username"
action 2.6 cli command "username" pattern "DailyLog"
action 2.7 cli command "DailyLog"
action 3.0 cli command "clear ip nat statistics"
action 3.1 cli command "clear counters fastEthernet 0/0" pattern "confirm"
action 3.2 cli command "y"
action 3.3 cli command "clear counters fastEthernet 0/1" pattern "confirm"
action 3.4 cli command "y"
action 3.5 cli command "delete flash:/dailylog" pattern "dailylog"
action 3.6 cli command "dailylog" pattern "confirm"
action 3.7 cli command "y"
ACMGJC_Router1#event manager run DailyArchive
Jul 1 14:09:04.639: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : CTL : cli_open called.
Jul 1 14:09:04.663: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1>
Jul 1 14:09:04.663: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1>enable
Jul 1 14:09:04.679: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1#
Jul 1 14:09:04.679: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1#show process cpu history | redirect flash:/dailylog
Jul 1 14:09:05.215: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT :
Jul 1 14:09:05.215: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1#
Jul 1 14:09:05.215: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1#show interface fastethernet 0/0 | append flash:/dailylog
Jul 1 14:09:05.675: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT :
Jul 1 14:09:05.675: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1#
Jul 1 14:09:05.675: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1#show interface fastethernet 0/1 | append flash:/dailylog
Jul 1 14:09:06.047: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT :
Jul 1 14:09:06.047: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1#
Jul 1 14:09:06.051: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1#show ip nat translations | append flash:/dailylog
Jul 1 14:09:10.171: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : ACMGJC_Router1#
Jul 1 14:09:10.171: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : ACMGJC_Router1#copy flash:/dailylog scp://username:password@SCP IP/DailyLog
Jul 1 14:09:10.287: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : Address or name of remote host [SCP IP]?
Jul 1 14:09:10.287: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : SCP IP
Jul 1 14:09:10.299: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : Destination username [username]?
Jul 1 14:09:10.299: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : username
Jul 1 14:09:10.311: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : OUT : Destination filename [DailyLog]?
Jul 1 14:09:10.311: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : IN : DailyLog
ACMGJC_Router1#
Jul 1 14:09:24.717: %HA_EM-6-LOG: DailyArchive : DEBUG(cli_lib) : : CTL : cli_close called.
Solved! Go to Solution.
07-01-2010 11:30 AM
Yes, maxrun is the way to go. You can create a timestamped file by adding $_event_pub_sec to the filename. This will add the number of seconds since January 1, 1970 to the file name which will make it unique across multiple executions.
07-01-2010 10:38 AM
If you configure "file prompt quiet" in the running config, which makes the SCP copy non-interactive, does the applet then complete the SCP successfully?
As far as naming the DailyLog with timestamps, I think I rather have a script on the SCP server take care of that.
07-01-2010 10:39 AM
I resolve the problem by increasing the maxrun to 60. I still need to know how I can put the current time and date in the file name. The file will be reside in Windows server through SCP.
07-01-2010 11:30 AM
Yes, maxrun is the way to go. You can create a timestamped file by adding $_event_pub_sec to the filename. This will add the number of seconds since January 1, 1970 to the file name which will make it unique across multiple executions.
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