MikroTik PoE: automatically power cycle and reboot device when it becomes unresponsive.
Posted by jpluimers on 2021/09/24
In the past I had these manual scripts to power-cycle a hung RaaspberryPi device:
/interface ethernet poe set ether5 poe-out=off /interface ethernet poe set ether5 poe-out=forced-on
or on one line:
/interface ethernet poe set ether5 poe-out=off; /interface ethernet poe set ether5 poe-out=forced-on
I am going to try this script for the port having a Raspberry Pi on it (note: this requires a 48V power brick for the Mikrotik!) on RouterOS version 6.48.3 (stable):
/interface ethernet set [ find default-name=ether5 ] comment="RaspberryPi" poe-out=\ forced-on power-cycle-ping-address=192.168.124.38 power-cycle-ping-enabled=\ yes power-cycle-ping-timeout=2m
The above has not worked for a long time as per [Wayback] No POE Power Cycle @ hEX POE – MikroTik:
- [Wayback] 20180321: RouterOS version 6.83.* fails
- [Wayback] 20180412: RouterOS version 6.41.4 and 6.42rc56 fails
- [Wayback] 20180721: RouterOS version 6.42.6 fails
- [Wayback] 20190405: RouterOS version 6.44.2 fails
- [Wayback] 20190612: RouterOS version 6.43.16 fails
But it might be fixed as of [Wayback] RouterOS version v6.47.3[stable] as per [Wayback] MikroTik Routers and Wireless – Software: 6.47.3 (2020-Sep-01 05:24):
…
*) poe – fixed “power-cycle” functionality on RB960GSP;
…
Similar issues exist on RB760iGS/Hex S, and there the fix requires new hardware in addition to firmware as per [Wayback] POE OUT issue on ether5 rb760igs (no power) – MikroTik
Note that I did disassemble both of these routers for inspection and there are obvious changes to the hardware to correct the PoE problems – most notably a completely different relay, capacitor and some minor circuit design changes.
If it still fails, I might try
[Wayback] No POE Power Cycle @ hEX POE – MikroTik: workaround script
:local ipPing ("x.x.x.x") :local pingip # # pingip below RUNS and sets the variable # to number of successful pings ie 3 means 3 of 45 success # can also use ($pingip > 1) or ($pingip >= 1) both TESTED # ($pingip >= 1) means if only 1 or 0 pings do the IF, not the ELSE # :log info ("ping CHECK script IS RUNNING NOW") # first delay 90 b4 ping test incase this is running at POWER UP :delay 90 :set pingip [/ping $ipPing count=45] :if ($pingip <= 3) do={ :log warning (">95% lost ping LOSS to isp GW IP x.x.x.x via ether5 so DO POE powerCYCLE") /interface ethernet poe set ether5 poe-out=off :delay 12 /interface ethernet poe set ether5 poe-out=auto-on :delay 10 :log warning ("ether5 POE HAS BEEN TURNED BACK ON") :delay 90 /system script run emailPOEresult } else={ :log warning ("PoeCyclePINGcheck ELSE ran so no ping loss detected by script") }
Based on:
- [WayBack] Manual:PoE-Out – MikroTik Wiki
- [WayBack] power cycle ping ip address – MikroTik
- [Wayback/Archive.is] PoE-Out – RouterOS – MikroTik Documentation
–jeroen
Leave a Reply