04-02-2009 02:10 AM
We use the event manager for starting a tcl script.
But the tcl script cannot run.
After a launch the record appeared in the log:
016038: .Apr 2 15:40:26.100 PCTime: %HA_EM-3-FMPD_CLI_CONNECT: Unable to establish CLI session: timeout error
If I start the script by hand, it works normally.
Cisco 1812, ios c181x-advipservicesk9-mz.124-15.T8.bin
The part of the config:
event manager applet MainLinkLost
event counter name "lost_count" entry-val 12 entry-op eq exit-val 12 exit-op eq
action 1.0 syslog msg "ALARM link to 91.x.x.x is down. Going to backup channel"
action 2.0 cli command "tclsh test.tcl"
The script contains only one string -
puts "TEST MESSAGE"
I suspect a problem with IOS, because on an earlier IOS it worked.
What can be wrong?
Solved! Go to Solution.
04-02-2009 10:00 AM
First, you should not be chaining EEM and tclsh together. Instead, convert your tclsh script to an EEM Tcl policy. For example, the attached policy will do what you're doing now.
Second, tclsh requires enable level 15 access. Therefore, you will need something like the following in your applet:
action 1.5 cli command "enable"
04-07-2009 08:54 AM
No, Safe Tcl does not support exec. However, if you look at the same policy I wrote for you, I included my run_cli proc. You can use this proc to easily run CLI commands. For example:
run_cli [list "clear ip nat translation forced" "clear crypto isakmp" "clear crypto session"]
You also have "enable" twice in this applet.
04-02-2009 10:00 AM
First, you should not be chaining EEM and tclsh together. Instead, convert your tclsh script to an EEM Tcl policy. For example, the attached policy will do what you're doing now.
Second, tclsh requires enable level 15 access. Therefore, you will need something like the following in your applet:
action 1.5 cli command "enable"
04-07-2009 03:12 AM
Thank you!
I solved this problem. I replaced the tcl script by the EEM with cisco IOS CLI.
At first I tried to use the EEM tcl policy, but it doesn't support the exec function in user mode.
event manager applet MainLinkLost
event counter name "lost_count" entry-val 12 entry-op eq exit-val 12 exit-op eq
action 0.5 syslog msg "ALARM link to 91.x.x.x is down. Going to backup channel"
action 0.7 cli command "enable"
action 1.0 cli command "enable"
action 1.1 cli command "clear ip nat translation forced"
action 1.2 syslog msg "command _clear ip nat translation forced_ was executed output - $_cli_result "
action 1.4 cli command "clear crypto isakmp"
action 1.5 syslog msg "command _clear crypto isakmp_ was executed output - $_cli_result "
action 1.7 cli command "clear crypto session"
action 1.8 syslog msg "command _clear crypto session_ was executed output - $_cli_result "
action 3.0 cli command "copy flash:configs/tobackup.cfg running-config" pattern "running-config"
action 4.0 cli command "running-config"
There is a documentation, If somebody interested in it.
04-07-2009 08:54 AM
No, Safe Tcl does not support exec. However, if you look at the same policy I wrote for you, I included my run_cli proc. You can use this proc to easily run CLI commands. For example:
run_cli [list "clear ip nat translation forced" "clear crypto isakmp" "clear crypto session"]
You also have "enable" twice in this applet.
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