Re: EEM

From: Nicolás Leiva <nicolasleiva_at_gmail.com>
Date: Sun, 17 Jan 2010 02:44:53 -0300

Not sure what you're trying to accomplish, but you could extract that value
with a regexp:

event manager applet HELLv2
 event none sync yes
 action 000 cli command "ena"
 action 005 cli command "sh proc cpu"
 action 010 set lines "0"
 action 020 foreach _it "$_cli_result" "\n"
 action 022 if $lines gt 6
 action 023 break
 action 024 end
 action 025 if $lines eq 0
 action 026 regexp "(five minutes:) ([0-9]+)" "$_cli_result" All first
second
 action 027 puts "\n\n ***Your Value is: $second ***"
 action 028 end
 action 030 puts "$_it"
 action 031 increment lines
 action 040 end

R5#event manager run HELLv2

 ***Your Value is: 2 ***

CPU utilization for five seconds: 16%/5%; one minute: 3%; five minutes: 2%
 PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
   1 16 78 205 0.00% 0.00% 0.00% 0 Chunk
Manager
   2 8 1222 6 0.00% 0.04% 0.03% 0 Load
Meter
   3 12484 10074 1239 0.00% 0.10% 0.11% 0
Exec
   4 4 1 4000 0.00% 0.00% 0.00% 0
EDDRI_MAIN
   5 8244 726 11355 0.00% 0.11% 0.11% 0 Check
heaps

R5#

Nicolas
http://ccie-en-espanol.blogspot.com/

On Sat, Jan 16, 2010 at 5:08 PM, Divin Mathew John <divinjohn_at_gmail.com>wrote:

> event manager applet HELL
> event none
> action 000 cli command "ena"
> action 005 cli command "sh proc cpu"
> action 010 set lines "0"
> action 020 foreach _it "$_cli_result" "\n"
> action 022 if $lines gt 6
> action 023 break
> action 024 end
> action 030 puts "$_it"
> action 031 increment lines
> action 040 end
>
> Its working now.! I rewrote the whole thingy.
> Router#event manager run HELL
>
> CPU utilization for five seconds: 5%/0%; one minute: 3%; five minutes: 4%
> PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
> 1 12 66 181 0.00% 0.00% 0.00% 0 Chunk
> Manager
> 2 572 1499 381 0.07% 0.02% 0.00% 0 Load Meter
> 3 0 1 0 0.00% 0.00% 0.00% 0 chkpt
> message ha
> 4 0 1 0 0.00% 0.00% 0.00% Router#event
> manager run HELL
>
>
>
> Some one tell me how do i get the value of five minutes: 4%. The value 4
> into a variable?
>
>
>
> On Sun, Jan 17, 2010 at 1:35 AM, Ryan West <rwest_at_zyedge.com> wrote:
>
> > Divin,
> >
> > Which part doesn't work? If you're trying to send an email, have you set
> > an SMTP server?
> >
> > -ryan
> >
> > > -----Original Message-----
> > > From: nobody_at_groupstudy.com [mailto:nobody_at_groupstudy.com] On Behalf
> Of
> > > Divin Mathew John
> > > Sent: Saturday, January 16, 2010 2:17 PM
> > > To: Cisco certification
> > > Subject: EEM
> > >
> > > event manager applet dump-procs
> > > event syslog pattern "CPURISINGTHRESHOLD"
> > > action 001 cli command "enable"
> > > action 002 cli command "show proc cpu sorted 5min"
> > > action 003 set lines 0
> > > action 004 foreach line "$_cli_result" "\n"
> > > action 005 if $lines gt 6
> > > action 006 break
> > > action 007 end
> > > action 008 append output $line
> > > action 009 increment lines
> > > action 010 end
> > > action 011 mail to user_at_company.com from user_at_company.com server
> > > 10.1.1.1 subject "Top five processes" body "$output"
> > > action 012 syslog msg "Top five processes: $output"
> > >
> > >
> > > I got this code from
> > >
> https://supportforums.cisco.com/message/2011660;jsessionid=22D30B42529F
> > > 604C48ADCBA3928C2882.node0
> > > .
> > > It doesnt seem to work? any ideas?
> > > --
> > >
> > > Sent from Bangalore, KA, India
> > >
> > >
> > > Blogs and organic groups at http://www.ccie.net
> > >
> > > _______________________________________________________________________
> > > Subscription information may be found at:
> > > http://www.groupstudy.com/list/CCIELab.html
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
> --
>
> Sent from Bangalore, KA, India
>
>
> 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 Jan 17 2010 - 02:44:53 ART

This archive was generated by hypermail 2.2.0 : Thu Feb 04 2010 - 20:28:41 ART