SCOM 2019 Datawarehouse SQL query for Agent Count for each period of time

D D 6 Reputation points
2022-09-12T15:55:03.503+00:00

What would be a good SQL Query for SCOM 2019 data warehouse to get the Agent Count for each period of time.

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,469 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. SChalakov 10,381 Reputation points MVP
    2022-09-13T08:46:21.547+00:00

    Hi @D D ,

    I played a bit and could prepare this for you:

    SELECT DisplayName,DWCreatedDateTime   
    FROM [OperationsManagerDW].[dbo].[vManagedEntity]   
    WHERE [FullName] LIKE 'Microsoft.SystemCenter.HealthService:%'  
    AND DWCreatedDateTime between '2022-01-01' and '2022-09-13'  
    

    this will give you all agents installed between '2022-01-01' and '2022-09-13'. You can adjust the dates according to your needs. You need to count the rows in the output.

    If you want to get the count only, then you can use the "COUNT()" function with the query:

        SELECT COUNT(*)  
        FROM [OperationsManagerDW].[dbo].[vManagedEntity]   
        WHERE [FullName] LIKE 'Microsoft.SystemCenter.HealthService:%'  
        AND DWCreatedDateTime between '2022-01-01' and '2022-09-13'  
    

    This will return the count of the agents for the given period.

    I hope I was able to help you out.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
    Regards
    Stoyan Chalakov

    1 person found this answer helpful.

  2. SChalakov 10,381 Reputation points MVP
    2022-09-14T06:14:41.367+00:00

    Hi @D D ,

    the second query returns the total agent count for the specific period. In your case:

         SELECT COUNT(*)  
         FROM [OperationsManagerDW].[dbo].[vManagedEntity]   
         WHERE [FullName] LIKE 'Microsoft.SystemCenter.HealthService:%'  
         AND DWCreatedDateTime between '2022-03-01' and '2022-08-01'  
    

    This returns the total count of agents with a "DWCreatedDateTime" between MArch and August 2022.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
    Regards
    Stoyan Chalakov

    1 person found this answer helpful.
    0 comments No comments

  3. Simon Ren-MSFT 33,226 Reputation points Microsoft Vendor
    2022-09-13T07:35:29.38+00:00

    Hi,

    Here are some similar threads for your reference:

    SCOM Agent list and count from datawarehouse (not operations database)
    Count the number of the SCOM agents which have critical alerts for a specific period

    Thanks for your time,

    Best regards,
    Simon


    If the response 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.