I recently ran into an issue at one of our remote sites where a switch won't recognize the installed fiber module. One of the ports on that module is the uplink. We suspect that the module is faulty but until we are able to get back on-site, we are reliant on a third-party to power cycle the switch in order for it to recognize the module again.
Switch Ports Model SW Version SW Image Mode
------ ----- ----- ---------- ---------- ----
* 1 56 WS-C3850-48P 16.3.7 CAT3K_CAA-UNIVERSALK9 INSTALL
In the meantime, I created an EEM script to reboot the switch when it loses internet connectivity:
Switch#sh run | sec ip sla
track 1 ip sla 1
delay down 60 up 120
ip sla 1
icmp-echo 8.8.8.8
frequency 10
ip sla schedule 1 life forever start-time now
Switch#sh run | sec event
event manager applet NO_CONNECTIVITY_REBOOT
event syslog pattern "1 ip sla 1 state Up -> Down" maxrun 700
trigger delay 600
action 1.0 cli command "enable"
action 2.0 cli command "reload" pattern "confirm"
action 3.0 cli command "y"
I have tested this script on a similar switch and while it does reload, it will not power cycle again until internet connectivity is restored and dropped again. From the articles I've seen, I can achieve a continuous reload cycle by setting the event to "event track 1 state down" instead of a syslog message but it seems like that option is not available on this switch.
Optimally, I would like to have the switch wait for 10 minutes before reloading and continue that cycle as long as it cannot ping 8.8.8.8. Additionally, if during that 10 minute window connectivity is restored, I would like to cancel the reload. I am very new to using EEM and would appreciate any advice. Thanks!