cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1260
Views
0
Helpful
3
Replies

problem with event manager

a.postempskiy
Level 1
Level 1

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?

2 Accepted Solutions

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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"

View solution in original post

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.

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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"

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.

http://www.cisco.com/en/US/docs/ios/netmgmt/configuration/guide/nm_eem_policy_cli_ps6441_TSD_Products_Configuration_Guide_Chapter.html#wp1012223

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.