Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

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
Cisco Employee

Tcl Script Assistance/Modification

On what version of IOS are you trying to register this Tcl policy?

New Member

Tcl Script Assistance/Modification

Hi Joseph,

The IOS is:

Cisco IOS Software, 7200 Software (C7200-SPSERVICESK9-M), Version 15.0(1)M9, RELEASE SOFTWARE (fc1)

Cheers

I should mention I'm using GNS3

Cheers

Cisco Employee

Tcl Script Assistance/Modification

Try converting it again and use that version.

New Member

Tcl Script Assistance/Modification

Joseph,

I'm not sure what you mean by 'that version'?

New Member

Tcl Script Assistance/Modification

Hi Joseph,

Just so you know, I tried loading the script to a 3660, just in case the problem was with the 7206. When I do so I get the following on the 3660:

R3(config)#even ma p OjectTracking.tcl

Compile check and registration failed:policy file does not start with event register cmd

Tcl policy execute failed: policy file does not start with event register cmd

Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy OjectTracking.tcl: Unknown error 0

New Member

Tcl Script Assistance/Modification

Sorry Joseph, I understand what you meant.

I recreated the script and applied it but still get the following error:

R3(config)#even ma p objectv2.tcl

Compile check and registration failed:policy file does not start with event register cmd

Tcl policy execute failed: policy file does not start with event register cmd

Embedded Event Manager configuration: failed to retrieve intermediate registration result for policy objectv2.tcl: Unknown error 0

R3(config)#

New Member

Tcl Script Assistance/Modification

Hi Joseph,

Back on the 7206 and I get the following error:

R3(config)#even manager pol objectv2.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 objectv2.tcl

Cisco Employee

Tcl Script Assistance/Modification

Reconvert it again.  That version should work.

New Member

Re: Tcl Script Assistance/Modification

Hi Joseph,

I have reconverted a number of times, however I'm still getting the same error message.

If you get some time, do you think you could take a quick look at it?

Cheers

Cisco Employee

Re: Tcl Script Assistance/Modification

I can register this policy just fine.  Make sure you're trying THIS version.

New Member

Re: Tcl Script Assistance/Modification

Joseph,

Sorry, but I don't know what you mean when you say THIS version.

Do you mean the version from the site that i use to convert the EEM? If so, I can only use the version that is provided on the site.

Again sorry but I don't understand

Cheers

Sent from Cisco Technical Support iPhone App

Cisco Employee

Re: Tcl Script Assistance/Modification

I mean the version you attached to this thread or the version you'd get by converting your applet now will register.  I tried it so I know it works.

New Member

Re: Tcl Script Assistance/Modification

Joseph,

I re-converted but still getting the following error:

R3(config)#even mana pol objectv4.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 objectv4.tcl

Cisco Employee

Re: Tcl Script Assistance/Modification

It works for me.  Perhaps your device doesn't support the track ED?

New Member

Re: Tcl Script Assistance/Modification

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#

Cisco Employee

Re: Tcl Script Assistance/Modification

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

New Member

Re: Tcl Script Assistance/Modification

Hi Joseph,

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

Cisco Employee

Re: Tcl Script Assistance/Modification

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.

New Member

Re: Tcl Script Assistance/Modification

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....

Cisco Employee

Re: Tcl Script Assistance/Modification

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.

New Member

Re: Tcl Script Assistance/Modification

Hi Joseph,

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

Thanks for your help anyway mate.

New Member

Re: Tcl Script Assistance/Modification

Joseph,

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

New Member

Re: Tcl Script Assistance/Modification

Joseph,

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

Cheers

Cisco Employee

Re: Tcl Script Assistance/Modification

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.

New Member

Re: Tcl Script Assistance/Modification

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.

New Member

Re: Tcl Script Assistance/Modification

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

..."

Cisco Employee

Re: Tcl Script Assistance/Modification

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"

New Member

Re: Tcl Script Assistance/Modification

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...

New Member

Re: Tcl Script Assistance/Modification

Joseph,

I got it to work.

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

Thank you so much mate.

481
Views
0
Helpful
29
Replies
CreatePlease login to create content