Need assistance for EEM appelate or TCL script

Unanswered Question
Oct 2nd, 2009

Hi All,

Trying to create an appelate (actually I did create one but it only works on 3.0) or a TCL script (actually trying to study it now)for a BGP hit. Currently have 12.4(8) which only supports 2.1 which is a problem. I figured I could do the same with a TCL script but have a problem there. What I need to do is look for a bgp syslog msg and then either invoke fast peering deactivation and/or shut down the interface and keep it on the backup. I also need to see 5 syslog messages within say 15 min before it does the same. I then want it to stay on the backup for 1 hr before it returns back to the primary. Not sure if I have made myself clear but willing to elaborate.

Been reading your scrips JClarke but limited to EEM2.1 so not sure where to go.

Regards

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
patrick.taylor Fri, 10/02/2009 - 18:26

Wow that was fast! Thanks,

here goes, got a few error msgs though when i ran on a 12.4(22) EEM 3.

And tried it with Fast peering which is again not supported on 12.4(8)..by the way EEM 2.2 is supported and I mentioned 2.1

Joe Clarke Fri, 10/02/2009 - 18:35

No, 12.4(8) only supports EEM 2.1. EEM 2.2 support was not added until 12.4(2)T.

That said, barring what appears to be some syntax issues, I see nothing here that requires EEM 3.0. These applets should work just fine with EEM 2.1.

I don't really understand what you're trying to accomplish with lines like:

action 05.0 cli command " event manager applet BGP_Down_fa0/1”

Are you trying to invoke the BGP_Down_fa0/1 policy?

patrick.taylor Fri, 10/02/2009 - 18:45

Yes I was, and the appelate is named but missing in the one I sent you, my bad. it was to remove fast peering one minute before it comes back up (after the 60 minutes) else if it takes another hit the fast peering would reactivate and my 60 minutes on backup becomes redundant. need the 5 hits to go on backup...

I thought fast peering deactivation was not available on the 12.4(8) I will recheck. If it is, I am smiling as I do need to tweak a little bit more and run more tests.

Joe Clarke Fri, 10/02/2009 - 18:58

You may be right from a BGP standpoint. However, from an EEM standpoint, you're not using any concepts that didn't exist in EEM 2.1.

If you want to invoke a policy which is already registered from within another policy, the policy to be invoked must be declared with a "none" event detector. Then you would do:

action X policy NAME

For example:

action 05.0 policy BGP_Down_fa0/1

However, if you want the BGP_Down_fa0/1 to be a countdown policy, then you'd actually need to configure the policy on the fly. Things become tricky here since you can't embed quotes into policies. The workaround is to declare an EEM environment variable to stand for the double-quote character:

event manager environment quote "

Then, you can configure your countdown policy:

action 05.0 cli command "event manager applet BGP_Down_fa0/1"

action 05.1 cli command "event timer countdown time 60"

action 05.2 cli command "action 1.0 cli command $quote enable$quote"

action 05.3 cli command "action 2.0 cli command $quote config t$quote"

action 05.4 cli command "action 3.0 cli command $quote router bgp 65501$quote"

action 05.5 cli command "action 4.0 cli command $quote passive-interface fa0/1$quote"

action 05.6 cli command "action 5.0 cli command $quote end$quote"

action 05.7 cli command "exit"

Then, the BGP_Down_fa0/1 policy will get registered on the fly, and begin its 60 second countdown.

patrick.taylor Fri, 10/02/2009 - 19:02

K thanks will modify and try. will get back to you on the results.

Thanks for the help!

Actions

This Discussion