SCOM Operations DB query to get agent health status with OS categorization

Fadil Ck 381 Reputation points
2024-09-17T06:31:38.7866667+00:00

Hi All,

We have a requirement to get health status of all servers using a sql query. Our idea is to create a table with columns Servers, Operating System (Linux/Windows) and Health status of each using a SQL query to display in a dashboard.

The dashboard should be live, so I assume we need to run in OperationsDB. Kindly assist in providing proper query, as I checked could not find any query to get OS details.

Regards

Fadil

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,475 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XinGuo-MSFT 17,701 Reputation points
    2024-09-18T07:50:24.5833333+00:00

    Hi,

    Here’s a SQL query for the SCOM Operations DB that retrieves the health status of agents along with their operating system categorization:

    SELECT 
        hs.DisplayName AS 'Agent Name',
        hs.HealthState AS 'Health Status',
        os.Caption AS 'Operating System'
    FROM 
        vManagedEntity AS me
    JOIN 
        vHealthService AS hs ON me.ManagedEntityId = hs.BaseManagedEntityId
    JOIN 
        vOperatingSystem AS os ON me.ManagedEntityId = os.BaseManagedEntityId
    WHERE 
        me.IsDeleted = 0
    ORDER BY 
        hs.DisplayName;
    
    

    This query joins the vManagedEntity, vHealthService, and vOperatingSystem tables to fetch the agent name, health status, and operating system details. Adjust the table and column names if they differ in your SCOM database schema.

    This is a list of queries that helpful in report writing or understanding the SCOM DB schema’s to get useful info.

    https://kevinholman.com/2016/11/11/scom-sql-queries/

    If you need further customization or have any other questions, feel free to ask!

    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.