To satisfy my curiosity on how to get this to work, i would do something like this:
event manager applet SHOW event none sync yes action 10 cli command "show proc cpu | incl ^ [1-5]" action 20 set SHOW "none" action 30 regexp ".*" "$_cli_result" SHOW action 90 puts "$SHOW" The hard part on something like this is figuring out what pipe options to specify to get just the output you need (this is where Tyson's post helped me). I guess you could do this solely with the regexp you're matching on, but i haven't had much luck with that. I tried stuff like this and i was not having any luck: event manager applet SHOW event none sync yes action 10 cli command "show proc cpu" action 20 set SHOW "none" action 30 regexp " ^[1-5]" "$_cli_result" SHOW action 90 puts "$SHOW" Like you, I'm still struggling with EEM REGEX matching and how to correctly define the string you are matching on. I also am not sure how i would use this to match on PIDs 1-15 or 10-15, as using the same concept above gets me PIDs 1 and 5 instead of the whole range. Needless to say i'm still working on my GREP skills. Nick On Feb 21, 2011, at 9:31 AM, Michal Styszynski wrote: > Hi Nick , thanks for the follow-up . Did you try these scripts , I copied it > into the 12.4.24.T2 with the event none and it doesn't work. > > cheers , > Michal > > > > > ________________________________ > From: Nicolas Bellenbaum <[email protected]> > To: Michal Styszynski <[email protected]> > Cc: [email protected] > Sent: Mon, February 21, 2011 3:56:38 PM > Subject: Re: [OSL | CCIE_RS] EEM applet > > Michal, > > There's a post Tyson responded to in the archives referencing this exact > question (title is EEM applet). I think this is the answer you're looking > for. > > Nick > > > On Feb 21, 2011, at 7:49 AM, Michal Styszynski wrote: > >> hello Marko , Tyson and all , >> I was re-listening the audio track on EEM done by Marko and so he was >> talking >> about the part CLI outputsfiltering at the very end of the lesson. >> >> Please , if you know any nice generic best practice on how to filter the >> cli >> show commands for just a couple of firstlinesor for lines for ex. between >> 10 >> and 15 , it would be very helpful. >> I used different regular expression combinations regarding the per line >> filtering but honestly the task is not easyor is getting hard to come up >> within >> >> the time we can dedicate during the real exam. >> >> Thanks for any best practice hints or additional examples are very welcome. >> I tries the foreach action but it doesn't really work as should. >> Thanks in advance for any help on that. >> >> Kind regards , >> Michal >> >> >> >> _______________________________________________ >> For more information regarding industry leading CCIE Lab training, please >> visit >> www.ipexpert.com > > > > _______________________________________________ > For more information regarding industry leading CCIE Lab training, please > visit www.ipexpert.com _______________________________________________ For more information regarding industry leading CCIE Lab training, please visit www.ipexpert.com
