I’m trying to build a SQL query that I can use in the SQL plugin to display the number of objects that have a particular alert or are in a particular state.


# of Servers with a Heartbeat Failure
# of Logical Disks with critically low disk free space

While I can create views that show the particular objects, we’re also wanting to “know the number” of specific objects of type.


Jelly answered
    • Do you have any SQL so far - might be a useful starting point. It sounds like you could add a COUNT() in.
    • I use this to show me gray agents from the OpsMgrDB SELECT ManagedEntityGenericView.DisplayName, ManagedEntityGenericView.AvailabilityLastModified FROM ManagedEntityGenericView INNER JOIN ManagedTypeView ON ManagedEntityGenericView.MonitoringClassId = ManagedTypeView.Id WHERE (ManagedTypeView.Name = 'microsoft.systemCenter.agent') AND (ManagedEntityGenericView.IsAvailable = 0) ORDER BY ManagedEntityGenericView.DisplayName