cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2293
Views
0
Helpful
12
Replies

Tcl Script Check Please Pt2

Hello Community,

Can someone please take a look at the attached script and let me know why I keep on getting the following error message:

EEM configuration: failed to retrieve intermediate registration result for policy test3newtalkers.tcl

I have saved the script as ansi, but I still keep on getting the error message

Your help will be greatly appreciated.

Cheers

Carlton

1 Accepted Solution

Accepted Solutions

Your have two actions with the same label.  Change the labels.

View solution in original post

12 Replies 12

Community,

I forgot to mention that the error message also included the following:

EEM Register event failed:missing close-bracket

    while compiling

"if"

Hope that helps you to help me.

This script is fine.  Try copying it back to your router, then verify its contents compared to this version.  I'm able to register it just fine.

Hi Joseph

Thanks again for responding.

To be honest I can register the script if I upload it using regular tftp. However, when attempt to register it with an application called called RuBAN it fails.

Any ideas why?

Sent from Cisco Technical Support iPad App

If you copy the script to the device and it looks the same on the device as on the source host (and the file size matches exactly) then it will register.

Hi Joesph,

Thanks again for responding.

Going to try it now...

OK Joseph,

I think I've figured out the problem.

When I upload the script via normal TFTP I get the following

if [catch {cli_exec $cli1(fd) "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source-port tran destination-port ipv4 protocol application name timestamp sys-uptime first interface input sort counter bytes top 4 format table"} _cli_result] {

    error $_cli_result $errorInfo

}

However, when I upload the script using RuBAN I get the following:

if [catch {cli_exec $cli1(fd) "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source-port tran destination-port ipv4 protocol application name timestamp sys-uptime first interface input sort counter bytes top 4 format t

    error $_cli_result $errorInfo

}

You will notice that able"} _cli_result] { is missing.

Can you show me how to truncate the line? I think I need to add something like \n but I'm not sure.

Cheers mate.

Hi Joseph,

I'm not sure if I should submit a new question, however in addition to the truncation question can you tell me why the following script won't add the alias

"alias exec toptalkers event manager run toptalkers.tcl" from the following script?

::cisco::eem::event_register_none

#

# This EEM tcl policy was generated by the EEM applet conversion

# utility at http://www.marcuscom.com/convert_applet/

# using the following applet:

#

# event manager applet Ttalkers

# event none

# action 1.1 cli command "enable"

# action 1.2 info type routername

# action 1.5 cli command "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source tran destinatio interfa input ipv4 protocol coll appl name time sys first sort count bytes 20 form tab"

# action 1.6 mail server "10.44.108.95" to "carlton.patterson@ska.co.uk" from "carlton.patterson@ska.co.uk" subject "toptalkers: $_info_routername" body "TopTalker Script $_cli_result"

# action 1.6 cli command "conf t"

# action 1.7 cli command "alias exec toptalkers event manager run toptalkers.tcl"

# action 1.8 cli command "end"

#

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]

if [catch {cli_open} result] {

    error $result $errorInfo

} else {

    array set cli1 $result

}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {

    error $_cli_result $errorInfo

}

array set _sinfo [sys_reqinfo_routername]

set _info_routername $_sinfo(routername)

if [catch {cli_exec $cli1(fd) "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source tran destinatio interfa input ipv4 protocol coll appl name time sys first sort count bytes 20 form tab"} _cli_result] {

    error $_cli_result $errorInfo

}

set mail_pre "Mailservername: 10.44.108.95\n"

append mail_pre "From: carlton.patterson@skanska.co.uk\n"

append mail_pre "To: carlton.patterson@skanska.co.uk\n"

append mail_pre "Cc: \n"

append mail_pre "Subject: toptalkers: $_info_routername\n\n"

append mail_pre "TopTalker Script $_cli_result\n\n"

set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]

if [catch {smtp_send_email $mail_msg} result] {

    error $result $errorInfo

}

if [catch {cli_exec $cli1(fd) "conf t"} _cli_result] {

    error $_cli_result $errorInfo

}

if [catch {cli_exec $cli1(fd) } _cli_result] {

    error $_cli_result $errorInfo

}

if [catch {cli_exec $cli1(fd) "end"} _cli_result] {

    error $_cli_result $errorInfo

}

# Close open cli before exit.

catch {cli_close $cli1(fd) $cli1(tty_id)} result

Cheers mate.

Your have two actions with the same label.  Change the labels.

Appreciate it mate.

Hi Joesph,

I rated the answer too quickly :-)

I made the change as you suggested, however the script still won't add the alias:

::cisco::eem::event_register_none

#

# This EEM tcl policy was generated by the EEM applet conversion

# utility at http://www.marcuscom.com/convert_applet/

# using the following applet:

#

# event manager applet Ttalkers

# event none

# action 1.1 cli command "enable"

# action 1.2 info type routername

# action 1.5 cli command "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source tran destinatio interfa input ipv4 protocol coll appl name time sys first sort count bytes 20 form tab"

# action 1.6 mail server "10.44.108.95" to "carlton.patterson@ska.co.uk" from "carlton.patterson@ska.co.uk" subject "toptalkers: $_info_routername" body "TopTalker Script $_cli_result"

# action 1.7 cli command "conf t"

# action 1.8 cli command "alias exec toptalkers event manager run toptalkers.tcl"

# action 1.9 cli command "end"

#

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]

if [catch {cli_open} result] {

    error $result $errorInfo

} else {

    array set cli1 $result

}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {

    error $_cli_result $errorInfo

}

array set _sinfo [sys_reqinfo_routername]

set _info_routername $_sinfo(routername)

if [catch {cli_exec $cli1(fd) "show flow monitor FlowMonitor1 cache aggr ipv4 destin addr ipv4 source addr tran source tran destinatio interfa input ipv4 protocol coll appl name time sys first sort count bytes 20 form tab"} _cli_result] {

    error $_cli_result $errorInfo

}

set mail_pre "Mailservername: 10.44.108.95\n"

append mail_pre "From: carlton.patterson@ska.co.uk\n"

append mail_pre "To: carlton.patterson@ska.co.uk\n"

append mail_pre "Cc: \n"

append mail_pre "Subject: toptalkers: $_info_routername\n\n"

append mail_pre "TopTalker Script $_cli_result\n\n"

set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]

if [catch {smtp_send_email $mail_msg} result] {

    error $result $errorInfo

}

if [catch {cli_exec $cli1(fd) "conf t"} _cli_result] {

    error $_cli_result $errorInfo

}

if [catch {cli_exec $cli1(fd) "alias exec toptalkers event manager run TOPtalkers.tcl"} _cli_result] {

    error $_cli_result $errorInfo

}

if [catch {cli_exec $cli1(fd) "end"} _cli_result] {

    error $_cli_result $errorInfo

}

# Close open cli before exit.

catch {cli_close $cli1(fd) $cli1(tty_id)} result

Any thoughts?

Cheers

I see no reason why the alias wouldn't add.  Enable "debug event manager tcl cli" to see what the result of the CLI command.

You may have a bad TFTP server.  Try getting a new one or using a protocol other than TFTP to transfer the file.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: