Using Z2M "last seen" of ANY device as a trigger of automation

Hi.Is there a feasible was of triggering an automation if/when there was no last seen update of ANY device within the last X minutes?
Basically my Z2M gateway is regularly freezing every few days, potentially i may be able to restart it in automation via SNMP as its PoE powered, but before i even get there i need to find a reliable way of triggering an automation (without listing all the Zigbee devices within it)

Dinth,
Have you thought of maybe restarting it every night at a certain time (e.g., 3am)? Another thing you may also try is checking if two or more Zigbee devices are offline. I do this with my WiFi connection. If I have two or more offline for a few minutes, I reboot my WiFi router.