Condividi tramite


How to create a SCOM group from a SQL CMDB Query

<!--[if lt IE 9]>

<![endif]-->

Comments

  • Anonymous
    October 13, 2017
    The comment has been removed
    • Anonymous
      October 13, 2017
      nvm, resolved:$MS=Get-SCOMGatewayManagementServer -Name $FQDN $MS.ProxyingEnabled=$true$MS.ApplyChanges()
  • Anonymous
    October 16, 2017
    Hi Kevin, this is great!We're in the initial steps of going with a system generated naming convention in attempts to get rid of naming convention drift that has become more problematic over the years so we've been exploring how to query our CMDB as the authoritative source.The question I have is would you do this on a group by group basis by having a separate MP (with a different script for each one) or would you do all your group population based off this example?For example we could have one SQL query to get all the server information then build each group inside your script and populate the groups 1 by 1. Also what about UNIX/Linux servers, do you have an example of that in your script?Thanks!
    • Anonymous
      October 16, 2017
      Noah - That probably depends on how many groups we are talking. I am not a huge fan of "mega workflows" that do tons of discoveries, but that must be balanced with the number of individual workflows. If we are talking 500 groups or more, then I'd have to do some serious testing and would consider consolidation. Querying SQL is actually REALLY fast. What is slow is accessing the SDK. That would be the bottleneck for lots of small workflows. For unix/linux - you'd just change the class for the relationships, it would be the group contains Unix Computer.
      • Anonymous
        October 16, 2017
        Thanks for the reply, we've got a large number custom groups today but I'd say the number that I need focus on initially would be much smaller to start with. But you've covered the question I was more or less trying to get at with the bottleneck being on the SDK, not on the SQL side so we can figure that out.Today we've created attributes that are looking in WMI where we then determine the following support groups - OS, APP, DB, etc... and then build a dynamic group based on that. But we're trying to get out of that model of having that information locally on each server and have SCOM populate it's groups based on the CMDB so this is great to see an example of this out in the wild.Thanks again!
        • Anonymous
          October 25, 2017
          I'm using a different approach over the years.Instead of directly creating groups from a SQL query i've created a registry key with a group name value.I've created extended windows computer classes with that value as property and i group the computers dynamically based on the group class.I've created a SCOM task to edit the registry value.Daily i run an external script that:- gets all extended class property from SCOM (1 query to the SDK)- compares the values with a query from the database/CMDB (even excel sheet for some customers).- call the task for each value that has changed (1 SDK call for each task)The task is rarely fired after some time, making the impact on SCOM not such a big deal.
  • Anonymous
    October 18, 2017
    Hi Kevin,Is it possible to post this in a compiled MP? As of today we don't have MP Author Pro or VS at our disposal, although I'm exploring getting a trial to of Silect to see if it would benefit us. Efforts to use the script above in our own custom MP have been challenging to say the least. Thank you in advance if possible.
    • Anonymous
      October 19, 2017
      NM - Was able to figure this out with a combination of Notepad++ and MP Author (free).
      • Anonymous
        October 25, 2017
        If you can do that, you might just want to give VSAE a try.
  • Anonymous
    November 28, 2017
    Hi Kevin, superb article! thanks as alwaysCould this example be modifed to populate a group with instances of Microsoft.SQL.Server.Database class (or SQL 14/16), which match a particular name, would this be possible? Initially, i can see that the target relationship would be Microsoft.SQL.Server.Database...What else would be required to populate the group?Thanks!
    • Anonymous
      November 28, 2017
      Yes, it sure could be used for that, creating groups of SQL databases. You'd need to change the relationship, and the query in the script, then the discoverydata output section.