If you are willing to throw a bit of money rather than code at the problem:
Ubiquiti has a power strip in beta now that uses statistics from their routers to decide when to power cycle upstream devices.
You can also find "Web Power Switches" (https://www.amazon.com/dp/B0765NCB2L) under $200 that are scriptable, so when a ping to a specific site fails it cycles power to a set of devices.
Ooh I didn’t know about that Ubiquiti strip. I must admit that I didn’t even look about for existing solutions (honestly I just wanted to finally have a use for these plugs I had lying about).
Working in IT as a Systems Engineer, My thought process is always first -> Existing solution or Tool, if not exist, Patching existing tools together, if not exist, code our own solution.
Hah yes in this case I already had most of the tools lying about. In fact the hardest part was figuring out why the hell the barrel-jack didn’t fit in the modem. Ended up finding an Amazon review with the correct connector size.
Ubiquiti has a power strip in beta now that uses statistics from their routers to decide when to power cycle upstream devices.
You can also find "Web Power Switches" (https://www.amazon.com/dp/B0765NCB2L) under $200 that are scriptable, so when a ping to a specific site fails it cycles power to a set of devices.