cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3937
Views
0
Helpful
13
Replies

i was wondering why it will show the first ping but not the second ping

jamesbefreedeer
Beginner
Beginner

no event manager applet ping_5_min
event manager applet ping_5_min
event none
action 1.0 cli command "enable"
action 1.1 syslog msg "ping 1.1.1.1"
action 1.1.1 cli command "ping vrf mgt 1.1.1.1"
action 1.1.5 syslog msg "$_cli_result"
action 1.1.6 wait 2
action 1.2.1 syslog msg "part 2 starting"
action 1.2.2 syslog msg "ping 1.1.1.2"
action 2.2.3 cli command "ping vrf mgt 1.1.1.2"
action 2.2.3.2 wait 2
action 2.2.4 syslog msg "$_cli_result"
action 2.2.6 syslog msg "Done"

13 Replies 13

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

EEM policies have a 20 second maximum runtime by default.  If the pings fail, the applet will abort before it can get to action 2.2.4.  You'll need to increase the maxrun value to something like 45 seconds.

when i looked at example you put it in event but my event is none?

How would I define the maxrun?

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee
event none maxrun 45

Thank you that works

I'm trying to do the same thing in loop but it's not working

Can you tell me why?

 

no event manager applet pinglist
event manager applet pinglist
event none maxrun 45
action 1.0 cli command "enable"
action 2.0 set i 1
action 2.5 syslog msg "%i"
action 3.0 while $i lt 255
action 4.0 set var 1.1.1.
action 5.0 append var $i
action 5.5 put %var
action 6.0 cli command "ping vrf mgt $var"
action 9.0 append results $_cli_result
action 9.1 syslog msg "$results"
action 9.2 end
action 9.3 end

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee
Two things. One, replace ‘%’ with ‘$’. And two, you don’t have an action to increment $i.

After 1.1.1.6 it slow down a lot and feels like it's stuck and doesn't do anything.

Do you know what it might be?

 

csr1000v-1(config)#no event manager applet pinglist
csr1000v-1(config)#event manager applet pinglist
csr1000v-1(config-applet)#event none maxrun 45
csr1000v-1(config-applet)#action 1.0 cli command "enable"
csr1000v-1(config-applet)#action 2.0 set i 1
csr1000v-1(config-applet)#action 2.5 syslog msg "$i"
csr1000v-1(config-applet)#action 3.0 while $i lt 10
csr1000v-1(config-applet)#action 4.0 set var 1.1.1.
csr1000v-1(config-applet)#action 5.0 append var $i
csr1000v-1(config-applet)#action 5.5 put $var
csr1000v-1(config-applet)#action 6.0 cli command "ping vrf mgt $var"
csr1000v-1(config-applet)#action 9.0 syslog msg $_cli_result
csr1000v-1(config-applet)#action 9.1 increment i
csr1000v-1(config-applet)#action 9.2 end
csr1000v-1(config-applet)#end
csr1000v-1#event manager run pinglist
1.1.1.1
1.1.1.2
1.1.1.3
1.1.1.4
1.1.1.5

csr1000v-1#1.1.1.6
1.1.1.7

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee
Now you’re pinging 10 hosts. You need to increase maxrun. Probably best to put it to 300 now.

I figure out it was the time but now i'm stuck at running every 5 min and increase the maxrun
not sure what is the correct of telling it run every 5 min and it need to do /24

 

csr1000v-1(config)#no event manager applet pinglist
csr1000v-1(config)#event manager applet pinglist
csr1000v-1(config-applet)#event timer watchdog time 300 maxrun 300 name test
csr1000v-1(config-applet)#action 1.0 cli command "enable"
csr1000v-1(config-applet)#action 2.0 set i 1
csr1000v-1(config-applet)#action 2.5 syslog msg "$i"
csr1000v-1(config-applet)#action 3.0 while $i lt 255
csr1000v-1(config-applet)#action 4.0 set var 1.1.1.
csr1000v-1(config-applet)#action 5.0 append var $i
csr1000v-1(config-applet)#action 5.5 put $var
csr1000v-1(config-applet)#action 6.0 cli command "ping vrf mgt $var"
csr1000v-1(config-applet)#action 7.0 put $_cli_result
csr1000v-1(config-applet)#action 9.0 syslog msg $_cli_result
csr1000v-1(config-applet)#action 9.1 increment i
csr1000v-1(config-applet)#action 9.3 end
csr1000v-1(config-applet)#action 10 cli command "end"
csr1000v-1(config-applet)#end
csr1000v-1#event manager run pinglist
EEM policy pinglist not registered with event none Event Detector
csr1000v-1#

Do you know why it does like this command?

EEM policy pinglist not registered with event none Event Detector

 

event timer watchdog time 300 maxrun 300 name test

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

You can only run policies via "event manager run" if it uses the "none" event detector.  You've now configured it to be timed, so you can't run it manually unless you add multi-event detector support.

 

That said, I don't think this is the right solution for what you want to do.  To ping 254 hosts (assuming half of them won't respond) you're looking at potentially over a five-minute runtime.  I don't know why you'd need to ping this whole subnet every five minutes, but you should at least consider using the "repeat" and "timeout" keywords to ping and only sending one ping to each address and only waiting one second for a timeout.  That would max out at 254 seconds assuming every host is unreachable.

it runs every 5 min and it it stop at under 5 min.

i don't need to run it manual and that is why i get the error

Do you have advice how it should be running router.
how the script run in permission? 

Joe Clarke
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

Like I said in the other reply, I wouldn't do this every five minutes.  But if you had to, I gave some advice.  I don't understand the question about permission.

This is where it get stuck

 

csr1000v-1(config)#no event manager applet pinglist
csr1000v-1(config)#event manager applet pinglist
csr1000v-1(config-applet)#event none maxrun 40
csr1000v-1(config-applet)#action 1.0 cli command "enable"
csr1000v-1(config-applet)#action 2.0 set i 1
csr1000v-1(config-applet)#action 2.5 syslog msg "$i"
csr1000v-1(config-applet)#action 3.0 while $i lt 10
csr1000v-1(config-applet)#action 4.0 set var 1.1.1.
csr1000v-1(config-applet)#action 5.0 append var $i
csr1000v-1(config-applet)#action 5.5 put $var
csr1000v-1(config-applet)#action 6.0 cli command "ping vrf mgt $var"
csr1000v-1(config-applet)#action 7.0 put $_cli_result
csr1000v-1(config-applet)#action 9.0 syslog msg $_cli_result
csr1000v-1(config-applet)#action 9.1 increment i
csr1000v-1(config-applet)#action 9.2 put $i
csr1000v-1(config-applet)#action 9.3 end
csr1000v-1(config-applet)#end
csr1000v-1#event manager run pinglist
1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
csr1000v-1#
2
1.1.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
csr1000v-1#
3
1.1.1.3

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
csr1000v-1#
4
1.1.1.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
csr1000v-1#
5
1.1.1.5

csr1000v-1#
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.5, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
csr1000v-1#
6
1.1.1.6

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:

Recognize Your Peers