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. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

EEM v2.3 + TCL

Hi all,

i had to make a capacity planning script for my customer but I really don't find an issue.
My main problem is that i'm using EEM v2.3 and I don't have all features.

So, i want to catch the result of this command : "sh platform hardware capacity fab | i Bus"

And if the current percentage exceed 60% i would like to send a syslog message and a SNMP trap.

alias exec Bus-load tclsh sup-bootdisk:Bus_load.tcl

event manager applet Bus
event none (i will replace it by a cron-entry event)
action 1 cli command "enable"
action 2 cli command "Bus-load" (lauch the tcl script)
action 3 syslog priority critical msg "Result : $_cli_result"

And here is my tcl script :

set commande [exec "sh platform hardware capacity fab | i Bus"]
set result [regexp {.[0-9]%,} $commande Current_pourcent]

set result [regexp {[0-9]+} $Current_pourcent Current]

set Value [expr $Peak]

puts "$Value";

But this always send a syslog (not only when it exceeds 60%).

I can also make the condition in TCL but I can't send syslog in TCL because I can't import namespace.

I had another idea to solve my problem but I don't find anything on this.

I can store this value in an OID object et get it with a LMS but I don't find the right command.

Can someone can help me on this way too?

Thanks for your help, I'm very confused.

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: EEM v2.3 + TCL

You should be using EEM Tcl and not chaining together EEM with tclsh.  Try the attached EEM Tcl policy.  It's a none policy right now, but you can change it to a cron policy after you run your tests.

10 REPLIES
Cisco Employee

Re: EEM v2.3 + TCL

You should be using EEM Tcl and not chaining together EEM with tclsh.  Try the attached EEM Tcl policy.  It's a none policy right now, but you can change it to a cron policy after you run your tests.

New Member

Re: EEM v2.3 + TCL

first, thank you for your response

I will test it tomorrow

Just in case, do you have an exemple of a TCL policy under your hand (may i copy the file in flash?)

Cisco Employee

Re: EEM v2.3 + TCL

I'm not sure I understand the question.  I attached a sample Tcl policy to my last post that will do exactly what you want.  To install it, create a directory on flash called policies, then copy that file into it.  Then configure:

event manager directory user policy flash:/policies

event manager policy no_check_cap.tcl

Then run it with:

event manager run no_check_cap.tcl

New Member

Re: EEM v2.3 + TCL

yeah sorry for my bad english (i'm french)

but your answered my question

New Member

Re: EEM v2.3 + TCL

ok it seems to be working

i'll finalize my script this week

thanks a lot

New Member

Re: EEM v2.3 + TCL

I have a new problem if you can help me

This command works on my lab routers:

set output [run_cli [list "sh platform hardware capacity fab | i Bus"]]

But on routers in production the output variable is empty.

Is there something i don't know

New Member

Re: EEM v2.3 + TCL

ok i understand what's my problem on production

it seems that the command is sent in user mode.

We use an ACS on our network. Is this the cause?

Cisco Employee

Re: EEM v2.3 + TCL

If you're using AAA command authorization, you need to add the command:

event manager session cli username USER

Where USER is a username authorized to run all of the CLI commands in all of your EEM policies.

New Member

Re: EEM v2.3 + TCL

hi joseph, everything works thx

just a last question (if you know) :

is it possible to create a specific oid, and put the value in this oid?

Cisco Employee

Re: EEM v2.3 + TCL

You can use the EXPRESSION-MIB in your version of IOS to create an OID to store the value.  A package that uses EEM to do this can be found in the downloads section of our EASy project at http://www.cisco.com/go/easy .  Look for the cutom MIB package.

616
Views
0
Helpful
10
Replies