Within any organization who run a hybrid Office 365 setup, AAD Connect has a sync cycle of 30 minutes (default) and unless someone is on one of the sync servers or in the admin portal and spots an error, there is a possibility that Dir sync (deprecated technology but still can be used to refer to AAD Connect) could have failed and go unnoticed for some time.
In terms of generating an alert, there is more than one way to achieve this using a PowerShell job, or a task on the server using task scheduler that runs PowerShell, but for some organisations these things are not permitted or possible, so in steps Flow & Microsoft Graph.
Firstly, I’d advise popping over to the Microsoft Graph Explorer and authenticating with your admin account.
Check the box to Consent on behalf of your organization.
We are now going to access the organization resource type and look at at 2 properties, onPremisesSyncEnabled & onPremisesLastSyncDateTime.