07-23-2013 12:18 AM
Hello guys,
Last 2 days I am struggling with an EEM applet which need to write the last configuration commit into a file on the harddisk of ASR9K. When run the debug I can't see the CLI_OPEN action, which bothers me that something is wrong. I tried similar script with the same syntax on 7600 platform and there is no issue, but within XR there is. I will highly appreciate your help with the following task. Here is my configuration:
aaa authorization eventmanager default local
event manager directory user policy disk0:/scripts
event manager policy check_Access_PWs.tcl username eem persist-time infinite type user
username eem
group root-system
group cisco-support
The script:
::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
set errorInfo ""
action_syslog msg "STARTING ..."
# Starting the interaction with router
# for exporting the last commit configuration
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}
# Phase 1: issue the command
if [catch {cli_exec $cli1(fd) "show configuration commit changes last 1 | file harddisk:test"} result] {
error $result $errorInfo
}
if [catch {cli_read $cli1(fd) } result] {
error $result $errorInfo
} else {
set cmd_output $result
}
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
}
action_syslog priority info msg "ENDING ..."
Withing the debug output I can only see the following between Starting/Ending:
RP/0/RSP0/CPU0:Jul 23 10:11:56.202 EEST: tclsh[65837]: %HA_EM-6-LOG: check_Access_PWs.tcl: STARTING ...
RP/0/RSP0/CPU0:Jul 23 10:11:56.207 : eem_policy_dir[182]: fh_edm_get_fn: Invoked for item_name policy/check_Access_PWs.tcl. vec_entries-> total: 2, valid 1
RP/0/RSP0/CPU0:Jul 23 10:11:56.208 : eem_policy_dir[182]: fh_edm_get_fn: Sending username eem for policy check_Access_PWs.tcl
RP/0/RSP0/CPU0:Jul 23 10:11:56.210 : eem_policy_dir[182]: fh_edm_set_fn called with item_name user/check_Access_PWs.tcl/eem pid value 2437421
RP/0/RSP0/CPU0:Jul 23 10:11:56.210 : eem_policy_dir[182]: Updated pid field (2437421) for policy check_Access_PWs.tcl, user eem
RP/0/RSP0/CPU0:Jul 23 10:12:00.129 : tclsh[65837]: %HA_EM-6-LOG: check_Access_PWs.tcl: ENDING ...
I know that if the file exists on the storage it will give me error, but I can't have such file creation by the script ...
I tried to log all debug messages from my last attempt into the attached file.
Regards,
Rusi
07-23-2013 04:03 PM
Can you print the output of "show config commit changes last 1" to verify the script is actually running the CLI? If you run the full command manually, are you prompted for anything or does it write the file and return you to a prompt?
07-23-2013 10:27 PM
Hi Joseph,
Yes, I can execute that command:
show configuration commit changes last 1
Wed Jul 24 08:21:27.651 EEST
Building configuration...
!! IOS XR Configuration 4.0.3
l2vpn
bridge group 4010
bridge-domain 4111
neighbor 10.10.10.3 pw-id 4111
!
vfi 4111
neighbor 10.10.10.1 pw-id 4111
!
neighbor 10.10.10.2 pw-id 4111
Meanwhile, I found that the following line was making the trouble:
event manager policy check_Access_PWs.tcl username eem persist-time infinite type user
and changed it to:
event manager policy check_Access_PWs.tcl username eem persist-time 3600 type user
and everything is working now
Regards,
Rusi
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