cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2188
Views
0
Helpful
3
Replies

How to Apply QoS to an interface using EEM Scripting

tyrone powell
Level 1
Level 1

Good Afternoon

I'm trying to implement some EEM scripting. My objective is to apply a QoS policy to an interface based on the availability of a track statement.

When the track is down i want to apply the QoS policy, when the track is up I want the policy removed from the interface.

interface has no QoS applies during normal operation

interface FastEthernet0/0

ip address 10.10.10.3 255.255.255.0

duplex auto

speed auto

I have created relevant, class-map, policy-map, and tack statement and event manager applet as per below.

Router ios is 7200 Software (C7200-SPSERVICESK9-M), Version 12.4(22)T,

########### Event Manager version is as follows :

R2#show event manager version

Embedded Event Manager Version 3.00

Component Versions:

eem: (v300_throttle)1.1.267

eem-gold: (v300_throttle)1.0.8

eem-call-home: (v300_throttle)2.0.0R2#show event manager version
Embedded Event Manager Version 3.00
Component Versions:
eem: (v300_throttle)1.1.267
eem-gold: (v300_throttle)1.0.8
eem-call-home: (v300_throttle)2.0.0

                

event manager applet POLICE

event track 2 state down
action 1.0 cli command "enable"
action 1.5 cli command "conf t"
action 2.0 cli command "int fa0/1"
action 2.5 cli command "service-policy input POLICE"
action 3.0 cli command "end

###### track statement learned via eigrp  #####

track 2 ip route 2.2.2.2 255.255.255.255 reachability

##### shows track as being down and EEM applet being tied to the POLICE config

Track 2

  IP route 2.2.2.2 255.255.255.255 reachability

  Reachability is Down (no route)

    4 changes, last change 00:19:11

  First-hop interface is unknown

  Tracked by:

    EEM applet POLICE

Based on this information I would expect or hope that the event manager would kick in as the track statemnet is clearly down, however when i run the following command no output is returned

R2#show event manager policy active

"debug event manager all" returns nothing I can see that the policy is registered.

R2#show event manager policy registered

No.  Class     Type    Event Type          Trap  Time Registered           Name

1    applet    user    track               Off   Fri Oct 18 15:49:46 2013  POLICE track 2 state down

maxrun 20.000

action 1.0 cli command "enable"

action 1.5 cli command "conf t"

action 2.0 cli command "int fa0/0"

action 2.5 cli command "service-policy input POLICE"

action 3.0 cli command "end"

Is there an issue with my config? Is what I am trying to achieve possible (I assume it is)

Any help would be greatly appreciated

Thanks

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Well, the policy will run very quickly, so you may not catch it in policy active.  Look at show event manager history events to see if it ran.

Config-wise it looks okay.  If you have AAA command authorization configured, you will need to configure "event manager session cli username USER" where USER is a username authorized to run these CLI commands.

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Well, the policy will run very quickly, so you may not catch it in policy active.  Look at show event manager history events to see if it ran.

Config-wise it looks okay.  If you have AAA command authorization configured, you will need to configure "event manager session cli username USER" where USER is a username authorized to run these CLI commands.

Thanks Joseph

I can see the following which is a good sign.

No.  Job Id Proc Status   Time of Event            Event Type        Name

1    1      Actv success  Fri Oct18 15:35:56 2013  track             applet: POLICE

2    2      Actv success  Mon Oct21 13:17:28 2013  track             applet: POLICE

On a final note will the policy be automatically removed once the track statement is up or do I have to right a reverse policy to remove the QoS on the interface as below

event manager applet REMOVE-POLICE

event track 2 state up
action 1.0 cli command "enable"
action 1.5 cli command "conf t"
action 2.0 cli command "int fa0/1"
action 2.5 cli command "no service-policy input POLICE"
action 3.0 cli command "end

Cheers

That looks fine.