cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1199
Views
0
Helpful
10
Replies

EEM v2.3 + TCL

Florent CHETAIL
Level 1
Level 1

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

Joe Clarke
Cisco Employee
Cisco Employee

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.

View solution in original post

10 Replies 10

Joe Clarke
Cisco Employee
Cisco Employee

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.

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?)

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

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

but your answered my question

ok it seems to be working

i'll finalize my script this week

thanks a lot

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

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?

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.

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?

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.

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: