Regarding UPS, there are a few posts on here including this very cheap option for a few bucks.
If you want to power more devices like the router too then yeah best to get a larger option I think. This may help...
For notification regarding power out, the below may give some ideas...
I really like the one that uses WiFi presence (eg. check a cheap WiFi plug device using its reserved IP address to see if it's still accessible/online). Then power down the hub a certain time after that fails according to how long your UPS will last.