I would like to create a custom SQL warning is this possible ?
as an example the following code returns the status of always on databases's
If the status changes from SYNCHRONIZED I would like a critical flag to be shown.
select dc.database_name, dr.database_id, dr.synchronization_state_desc,
dr.suspend_reason_desc, dr.synchronization_health_desc
from sys.dm_hadr_database_replica_states dr join sys.availability_databases_cluster dc
on dr.group_database_id=dc.group_database_id
where is_local=1
order by 1
I have lots of other custom code like this that monitor the status of index's
Is this possible ?