09-17-2010 03:24 AM
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.
Solved! Go to Solution.
09-18-2010 10:37 PM
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.
09-18-2010 10:37 PM
09-19-2010 12:37 PM
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?)
09-19-2010 12:48 PM
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
09-19-2010 03:28 PM
yeah sorry for my bad english (i'm french)
but your answered my question
09-20-2010 10:10 AM
ok it seems to be working
i'll finalize my script this week
thanks a lot
09-21-2010 09:14 AM
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
09-21-2010 09:44 AM
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?
09-21-2010 09:56 PM
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.
09-22-2010 02:06 AM
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?
09-22-2010 07:35 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide