Seems straightforward enough.
Hub and PC are powered by UPS. PC is connected to UPS with serial cable.
When power goes out and there’s 5 mins left of UPS battery, PC shuts down.
Ping from hub to PC fails, so then hub shuts down too, before the UPS battery dies.