cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2054
Views
0
Helpful
29
Replies

Tcl Script Assistance/Modification

Hello Community,

I've converted an EEM to Tcl using the tool on this site. However, I'm getting the following error:

R3(config)#event manager policy OjectTracking.tcl

EEM Register event failed: Error empty reg spec, policy does not start with EEM registration commands.

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

Can someone please take a little look at the script and let me know what's wrong?

::cisco::eem::event_register_track tag SLA1 1 state down

::cisco::eem::event_register_track tag SLA2 2 state down

::cisco::eem::event_register_track tag SLA3 3 state down

::cisco::eem::trigger {

    ::cisco::eem::correlate event SLA1 or event SLA2 or event SLA3

}

#

# 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 object

#  event tag SLA1 track 1 state down

#  event tag SLA2 track 2 state down

#  event tag SLA3 track 3 state down

#  trigger

#   correlate event SLA1 or event SLA2 or event SLA3

#  action 1.0 syslog msg "Track $_event_tag1 is down"

#

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]

action_syslog msg "Track $_event_tag1 is down"

Cheers

Carlton

29 Replies 29

Hi Joseph,

Thanks for getting back to me, I do believe the device supports ED:

R3#show event manager version

Embedded Event Manager Version 3.10

Component Versions:

eem: (v310_throttle)4.1.23

eem-gold: (v310_throttle)1.0.7

eem-call-home: (v310_throttle)1.0.6

Event Detectors:

Name                Version   Node        Type   

application         01.00     node0/0     RP     

syslog              01.00     node0/0     RP     

track               01.00     node0/0     RP     

resource            01.00     node0/0     RP     

routing             02.00     node0/0     RP     

cli                 01.00     node0/0     RP     

counter             01.00     node0/0     RP     

interface           01.00     node0/0     RP     

ioswdsysmon         01.00     node0/0     RP     

none                01.00     node0/0     RP     

oir                 01.00     node0/0     RP     

snmp                01.00     node0/0     RP     

snmp-notification   01.00     node0/0     RP     

timer               01.00     node0/0     RP     

ipsla               01.00     node0/0     RP     

snmp-object         01.00     node0/0     RP     

test                01.00     node0/0     RP     

config              01.00     node0/0     RP     

env                 01.00     node0/0     RP     

gold                01.00     node0/0     RP     

nf                  01.00     node0/0     RP     

rpc                 01.00     node0/0     RP     

R3#

Paste the exact output when you "more" the file as you have copied it to the router.

Hi Joseph,

The output is just a load of numbers, see attached.

You need to upload the file as a plain ASCII text file.  I'm not sure how you're transferring it to the router, but that's clearly wrong.

Joseph,

I've uploaded the file using tftp server.

I've successfully uploaded other .tcl files from this site.

I don't think I'm doing anything different....

I don't know what more to tell you.  This is a hex dump of an ASCII file, not the raw file itself.  You need to get the raw ASCII file loaded on flash.

Hi Joseph,

I'll play around and see what I can do.

Thanks for your help anyway mate.

Joseph,

Just so you know the file is being loaded onto disk0:

Joseph,

Do you think you could convert it for me - just in case I'm converting incorrectly?

Cheers

I just downloaded the attached file you posted,  copied it to my router using TFTP, and registered it.  It worked.  It's  not a question of your file, but how it appears on flash.  Either how  you're saving it locally or how you're transferring it is not preserving  the original structure.

Success!

Joseph,

You were correct. The problem is the way I copy the file to the tftp server.

I simply extracted object4.tcl.zip, you tested in the previous post and I got no errors registering.

Now got to try and test it out.

Cheers mate.

Hi Joseph,

The problem I have now is that a need environment variable for $_event_tag1. But that variable represents, SLA1 or SLA2 or SLA3

*Jul 18 22:28:37.643: %TRACKING-5-STATE: 2 ip sla 2 reachability Up->Down

can't read "_event_tag1": no such variable

while executing

"action_syslog msg "Track $_event_tag1 is down""

invoked from within

"$slave eval $Contents"

(procedure "eval_script" line 7)

invoked from within

"eval_script slave $scriptname"

invoked from within

"if {$security_level == 1} {       #untrusted script

interp create -safe slave

interp share {} stdin slave

interp share {} stdout slave

..."

Multi-event is different in Tcl.  You have to test for each tag:

array set mar_einfo [event_reqinfo_multi]

set tag {}

foreach tag [list "SLA1" "SLA2" "SLA3"] {

    if { [info exists mar_einfo($tag)] } {

        break

    }

}

action_syslog msg "Track $tag is down"

Wow!

Where would I add that to the Tcl?

Seriously, if its too much trouble just point me in the right direction and I'll try and figure it out - you've helped me a great deal...

Joseph,

I got it to work.

You're a genius! Seriously, I was about to give up.

Thank you so much mate.

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: