marcingminski / sqlwatch

SQL Server Performance Monitor
https://docs.sqlwatch.io
Other
428 stars 168 forks source link

Initial run doesn't 'know of' offline-databases #434

Open DickUMCG opened 2 years ago

DickUMCG commented 2 years ago

Did you check DOCS to make sure there is no workaround? https://sqlwatch.io/docs/

Yep. Please update this to https://docs.sqlwatch.io as https://sqlwatch.io/docs returns a 404.

Describe the bug A clear and concise description of what the bug is.

Installed SQLWatch and after the first run table sqlwatch_meta_database shows a bunch of databases, but... on this specific server there was one database offline (due to decommission soon).

Noticed this when adding a server also monitored by Spotlight, for which we would like to replace SQLWatch, showed an offline database, whereas SQLWatch didn't.

To Reproduce Steps to reproduce the behavior:

  1. Go to..
  2. Click this..

New install.

Expected behavior A clear and concise description of what you expected to happen.

I would expect that 'all' databases would be taken into account. Maybe the query to fill sqlwatch_meta_database needs to include also offline databases, select name, state_desc for sys.databases shows the offline state.

Screenshots If applicable, add screenshots to help explain your problem.

Windows Server (please complete the following information):

SQL Server (please complete the following information):

SQL Server Management Studio (SSMS -> about -> copy info):

SQLWATCH version (from DACPAC or from sysinstances)

Additional context Add any other context about the problem here.

Not needed (I guess)

marcingminski commented 2 years ago

Thanks. Why would you want offline database to be added as a monitoring source? You can’t query it anyway to obtain tables and other objects so just adding it as a database object won’t give any benefit.

DickUMCG commented 2 years ago

Well, in this case I know it is expectedly offline, but what if it wasn't expected? Indeed I'm aware that you can't query it, but it would be good to know that it is offline. Ofcourse in this case I could temporarily put it online and after it's 'known' to sqlwatch put it offline again.

Ok, maybe it's more of a feature request than a bug. Thanks for your quick reply.

BTW, have to turn of a lot of measurements as otherwise I can't get a server in warning state or green state. We'll have to pinpoint on this more later. First goal is adding servers, and that's quite a lot. :-)

marcingminski commented 2 years ago

You should still get an alert that the database is OFFLINE. This is regardless whether its been added to the meta schema - meta tables are just for monitoring.

DickUMCG commented 2 years ago

Ok, maybe it takes a while, I see it’s being measured every 60 minutes and I installed it on this server about 1,5 hour ago.

I’ll keep an eye on this.

marcingminski commented 2 years ago

whats the outcome of the check in the check tables. Do you this database with the check "OFFLINE" as CRITICAL?

DickUMCG commented 2 years ago

I've used the defaults from the template, so in check_template_id 12 everything > 0 (meaning anything else than ONLINE) is regarded as critical. And unfortunately the offline-database deosn't show up anywhere in sqlwatch_config_check, sqlwatch_logger_check or sqlwatch_meta_check.

marcingminski commented 2 years ago

So I suspect the bug is that checks are being expanded based on the meta table, rather that sys.databases. I will take a look at this.