Forum Discussion

Lewis_Beard's avatar
31 days ago

Weird active discovery on Microsoft_SQLServer_Databases?

I'm in the process of updating all my modules to the new groovy4 versions, and I kinda saved the big impact ones for last. I'm literally about to update the last one, Microsoft_SQLServer_Databases, but when doing a test prior to the update, the new version gives back too many instances found than it should.

It always seems, no matter what server I test with my appliesTo and my ActiveDiscovery, its usually the first 4 duplicated onto the end.

Version 2.13.0 Gives this list, as an example:

MSSQLSERVER/master
MSSQLSERVER/tempdb
MSSQLSERVER/model
MSSQLSERVER/msdb
MSSQLSERVER/QRST
MSSQLSERVER/UVWX
MSSQLSERVER/ABCD
MSSQLSERVER/EFGH
MSSQLSERVER/IJKL
MSSQLSERVER/MNOP
MSSQLSERVER/QRST
MSSQLSERVER/UVWX
MSSQLSERVER/YYZ

Version 2.16.0 (latest) gives this result:

MSSQLSERVER/master
MSSQLSERVER/tempdb
MSSQLSERVER/model
MSSQLSERVER/msdb
MSSQLSERVER/QRST
MSSQLSERVER/UVWX
MSSQLSERVER/ABCD
MSSQLSERVER/EFGH
MSSQLSERVER/IJKL
MSSQLSERVER/MNOP
MSSQLSERVER/QRST
MSSQLSERVER/UVWX
MSSQLSERVER/YYZ
MSSQLSERVER/master
MSSQLSERVER/tempdb
MSSQLSERVER/model
MSSQLSERVER/msdb

I have all the dependencies mentioned under Technical Notes up to date. And it seems that every time I test the code I get these instance duplicates.

BTW the way I'm testing is I go to our test portal, update to latest, export as json, rename the file and the places inside the file to give it a new name, strip out the publish/identity hash section, change the appliesTo to false() and import back into the test environment. Then if it looks good, I import into prod, which I have done, but its completely a differently named version of the update with an empty appliesTo. Then I can hit edit and temporarily change the appliesTo without saving, and then test the active discovery. So I can see exactly what it will do.

Has anyone else experienced any weirdness like this? Is this common?

Thanks!

 

  • Taking a really quick look at the code, I think there is some bug related to the mssql.excludesystem_database property. The code wants to first list all DBs that are not system, then check if you don't have that property then add it at the end. I would guess the code is no longer properly excluding system DBs from the first part, then adds the system DBs again after checking that property.

    I'm not currently in a position to fully review/test code myself. You may need to have someone that knows groovy and/or compare the code between the two versions. Or perhaps you can report this to LM as a ticket so someone there can review the code, or if others on the forums wants to help.

    P.S. I'm willing to bet that setting mssql.excludesystem_database to true will "fix" the issue, but I don't suggest doing that since once the bug is fixed, you will lose system db data.

    • Lewis_Beard's avatar
      Lewis_Beard
      Icon for Expert rankExpert

      If thats the case, I am surprised people havent hit it yet. I mean, the force-upgrade to groovy4  is a real thing, even if they did push the required collector version date. Anybody with optional is probably getting that imminently (the optional version of the collector releases, which has the removal slated for March iirc).

      Basically, I'll be curious to know if this is a known bug when I open a support ticket tomorrow. I'll prob ask my customer success contact, as that way I might find out sooner than the usual turnaround time.

  • Without going thru the code itself, I would suggest going to the new module, edit it, and use the Test Active Discovery button. That will show you full table of data that it's reporting. Check if something is different between the two duplicates that may show a sign on why it's happening. Especially if the WildValue is different even if the WildAlias are the same.

    • Lewis_Beard's avatar
      Lewis_Beard
      Icon for Expert rankExpert

      I had visually skimmed it, but I just closely compared the duplicates and I dont see an issue. Even the properties that come back seem identical. But wildvalue2 and description are empty, maybe one of them has some leading or trailing whitespace or something I cant see.

      I've had this duplication issue on every server I've tested, which is about 10. Weird. I'll keep looking, and I guess I can control-A the whole thing and see if there are some whitespace differences that I cant visually detect, but at that point, what the LM UI displays vs what was in the source data, its hard to be sure.