A sample EEM script follows:
::cisco::eem::event_register_none Event Register Keyword
# Namespace imports
namespace import :: isco::eem::* Namespace Import
namespace import :: isco::lib::*
# Local procedure for CLI interface
# Pass a list of cli commands and it returns a list of outputs
#
proc CLICmdProc {cmds} {
if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}
if [catch {cli_exec $cli1(fd) "enable"} result] {
error $result $errorInfo
}
if [catch {cli_exec $cli1(fd) "term len 0"} result] {
error $result $errorInfo
}
foreach a_cmd $cmds {
if [catch {cli_exec $cli1(fd) $a_cmd} result] { Body
error $result $errorInfo
} else {
lappend cmd_output $result
}
}
if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
}
return $cmd_output
}
#
# Put commands here
#
# enhancement - read them from a file
#
lappend clicmd "show ip int brief"
lappend clicmd "show tech"
lappend clicmd "show clock"
#
set cliout [CLICmdProc $clicmd]
#
# write to a file
#
#
if [file exists $_ofilename] {
puts "file $_ofilename being overwritten"
}
set myfileid [open $_ofilename w+]
foreach outs $cliout {
puts $myfileid $outs
}
close $myfileid
http://forums.cisco.com/eforum/servlet/EEM?page=main
Send email applet:
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=921
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=921
Command repeat applet:
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=381
Multiple pipes:
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=2447
Sort by column:
http://forums.cisco.com/eforum/servlet/EEM?page=eem&fn=script&scriptId=2427
Caveat:
Triggers/Symptoms
CPU, Memory, or buffer resource diagnostics are all triggered by
crossing of user settable usage thresholds. Service Diagnostic scripts
in this area use two embedded IOS features - ERM and EEM. The scripts
dynamically generate an EEM policy that uses an ERM event detector in
the area to be monitored.
Actions/Outputs
The actions/outputs of these policies are limited to reporting the
threshold crossings. The value-add (over using ERM directly) is the
email notification capability, as well as providing a wrapper for
quickly configuring ERM (which is fairly complex). A typical message
follows:
*Feb 25 16:44:25.235: %HA_EM-6-LOG: tmpsys:/eem_policy/sdiag_Exec.tcl:
THE SERVICE DIAGNOSTIC MESSAGE FOR RESOURCE CPU MONITORING IS :
Process Exec with PID 227 exceeded the configured CPU utilization threshold 20
monitoring CPU
resource policy
user global HighGlobalCPU
policy HighGlobalCPU global
system
cpu total
critical rising 5 falling 2 interval 10
cpu process
critical rising 5 falling 2 interval 10
event manager applet ReportHighCPU
event resource policy "HighGlobalCPU"
action 1.0 syslog priority debugging msg "finally..."
event manager applet snmpcpuge75
event snmp oid 1.3.6.1.4.1.9.9.109.1.1.1.1.3.1 get-type exact
entry-op ge entry-val 75
poll-interval 10
action 1.0 cli command "enable"
action 2.0 cli command "show process cpu"
action 3.0 mail server "192.168.1.146" to "engineer_at_cisco.com" from
"devtest_at_cisco.com"
subject "B25 PBX Alert" body "$_cli_result"
cisco.com/go/beyond
On Sun, Jun 26, 2011 at 3:57 AM, Sunil pareek <skpareek84_at_gmail.com> wrote:
> Hi
>
> Thanks for the response.platform is cisco 7200 with 12.4(24)T4 ios.But can
> you tell me what is the exact diff. b/w version 1 and rest of the version
> ofcourse in brief or suggest any link.
>
>
> It will be helpful if you can help with any config template.
>
> Regards
> Sunil
> On Sat, Jun 25, 2011 at 5:31 PM, Brad Edgeworth <edgie512_at_gmail.com> wrote:
>
>> Which platform are you on? some platforms only support EEM 1.0
>>
>> On Jun 25, 2011 5:52 AM, "Sunil pareek" <skpareek84_at_gmail.com> wrote:
>> > Hi
>> >
>> > I am working with EEM these days.One of the requirement from the mgmt
>> says
>> > that email to should be triggered whenever the router CPU utilization
>> goes
>> > above 70% for the interval of 5 mins.mail should be sent to lets say
>> > abc_at_abc.net with having a list of top processes list which are causing
>> cpu
>> > utilization for example top 5 or 10.
>> >
>> > I came to know that this can be done with EEM.can someone please help me
>> > with the suitable config or link.And also is it recommended to like this
>> in
>> > Service provider network.
>> >
>> >
>> > Regards
>> > Sunil
>> >
>> >
>> > Blogs and organic groups at http://www.ccie.net
>> >
>> > _______________________________________________________________________
>> > Subscription information may be found at:
>> > http://www.groupstudy.com/list/CCIELab.html
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
Blogs and organic groups at http://www.ccie.net
Received on Sun Jun 26 2011 - 10:41:32 ART
This archive was generated by hypermail 2.2.0 : Fri Jul 01 2011 - 06:24:28 ART