Create Monitor with SQL Query

StatelyElf 21 Reputation points


The SCOM Monitor "Database Status" from MSSQL on Windows Management Pack checks if a DB is in offline, recovery, suspect or emergency state. But I can't configure, that it only alerts, when the state is suspect or emergency. Offline and Recovery are not a bad state for me, so i don't wanna an alert.

Is there a way to create my own monitor, that only alerts when the state is offline or emergency? Maybe with the SQL Query SELECT name, state_desc FROM sys.databases?

Kind Regards

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,320 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 39,181 Reputation points

    Sure you can query database state and filter out the unwanted:

    select name, state_desc  
    from sys.databases  
    where not state_desc in ('Offline', 'Recovering')  

    for all existing states

    0 comments No comments

  2. Cris Zhan-MSFT 6,601 Reputation points

    Hi @StatelyElf ,

    Is there any update on this case?

    Check this posts if help:

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments