cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4202
Views
9
Helpful
23
Replies

EEM applet for IPSLA

sathvik k v
Level 3
Level 3

Hi,

I have a scenario where i would like to execute a EEM applet for running an ip sla event when othe ip sla event is up. Just to summarize an IP sla event success should trigger anothe IP sla event. I have tried the two options below but was not able to find any debug logs.

ip sla 10
icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10
frequency 30
ip sla schedule 10 life forever start-time now

ip sla 20
icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10

frequency 30


event manager applet SLA
event timer cron cron-entry "5 * * * *"
event ipsla operation-id 10 reaction-type timeout
action 10   if $_ipsla_condition eq "Occurred"
action 15    cli command "enable"
action 20    cli command "configure term"
action 25    cli command "no ip sla schedule 20 life forever start-time now"
action 30    else
action 35    cli command "enable"
action 40    cli command "configure term"
action 45    cli command "ip sla schedule 20 life forever start-time now"
action 50   end

OR

ip sla 10
icmp-jitter x.x.x.x source-ip x.x.x.x num-packets 10
frequency 30
ip sla schedule 10 life forever start-time now

ip sla 20
icmp-jitter y.y.y.y source-ip y.y.y.y num-packets 10
frequency 30

track 1 ip lsa reachability

event manager applet SLA-1
event timer cron cron-entry "5 * * * *"

event track 1 state up

action 10 cli command "enable"

action 20 cli command "conf t"

action 30 cli command "ip sla schedule 20 life forever start-time now"

action 40 cli command "end"

 

event manager applet SLA-2

event timer cron cron-entry "5 * * * *"

event track 1 state down

action 10 cli command "enable"

action 20 cli command '' conf t"

action 30 cli command "no ip sla schedule 20 life forever start-time now"

action 40 cli command "end"

Regards,

Sathvik K V

2 Accepted Solutions

Accepted Solutions

In only uses the username for authorization.  Authentication is not done.

View solution in original post

The way this is written doesn't make a lot of sense.   I think you want:

event manager applet APP-1

event track 1 state up

action 001 cli command "enable"

action 002 cli command "show clock"

action 003 regexp "([0-9]+):[0-9]:[0-9]" $_cli_result match hour

action 004 if $hour ge 9

action 005 if $hour le 18

action 006 cli command "conf t"

action 007 cli command "ip sla 2"

action 008 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"

action 009 cli command "frequency 30"

action 010 cli command "ip sla schedule 2 life forever start-time now"

action 011 end

action 012 end

View solution in original post

23 Replies 23

Joe Clarke
Cisco Employee
Cisco Employee

I really don't understand why you have both a cron timer and an IPSLA event here.  If you just want to react to one IPSLA collector issue and configure another one depending on the condition, remove the cron event.

Joseph,

Had already tested without the cron event but the result is the same. Intially cron was configured to run the script only during buisness hours. So if would would like to run a script only during buisness hours with IPSLA what do you suggest?

Regards,

Sathvik

Have a look at the applets in https://supportforums.cisco.com/message/4025820#4025820 .  That will show you how to extract the "hours" portion of show clock then test against that to see if you're within your business hours window.

Thanks Joseph will check on that.

Regards,

Sathvik

Joseph,

Wanted some some guidance using event manager session cli username USER-NAME.  If i would like to authenticate the user using TACACS or RADIUS server how would it work.

Which all ways can be used to authenticate user before running a script.

Regards,

Sathvik K V

It works the same.  Just make sure the USER-NAME is known to TACACS or Radius.

So password should be provided in the script :  action 10 cli command "password"

Mentioning  password in the script is not suggested. Is there any other option that could be used??

Regards,

Sathvik

No, passwords are not required and not used.  You only need to specify the username.

Thank you will try the script now.

Just curious to know how would it work without a password

In only uses the username for authorization.  Authentication is not done.

Joseph,Thank you for the support

Hi Joseph,

I would like to run the script pasted below during buisness hours(9am to 6pm).  When two if conditions are used is it the first condition is checked and if that passes it will check the second condition.

event manager applet APP-1
event track 1 state up
action 001 cli command "enable"
action 002 cli command "show clock"
action 003 regexp "([0-9]+):[0-9]:[0-9]" $_cli_result match hour
action 004 if $hour ge 9
action 005 cli command "conf t"
action 006 cli command "ip sla 2"
action 007 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"
action 008 cli command "frequency 30"
action 009 cli command "ip sla schedule 2 life forever start-time now"
action 010 end
action 011 if $hour le 18
action 012 cli command "ip sla 2"
action 013 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"
action 014 cli command "frequency 30"
action 015 cli command "ip sla schedule 2 life forever start-time now"
action 016 end


event manager applet APP-2
event track 1 state down
action 10 cli command "enable"
action 20 cli command "conf t"
action 30 cli command "no ip sla 2"
action 40 cli command "end"

Regards,

Sathvik

The way this is written doesn't make a lot of sense.   I think you want:

event manager applet APP-1

event track 1 state up

action 001 cli command "enable"

action 002 cli command "show clock"

action 003 regexp "([0-9]+):[0-9]:[0-9]" $_cli_result match hour

action 004 if $hour ge 9

action 005 if $hour le 18

action 006 cli command "conf t"

action 007 cli command "ip sla 2"

action 008 cli command "icmp-echo x.x.x.x source-ip x.x.x.x"

action 009 cli command "frequency 30"

action 010 cli command "ip sla schedule 2 life forever start-time now"

action 011 end

action 012 end

Okie will check this. So a nested IF condition should be used.

Not much knowledge on EEM

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: