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.
As this hasn’t been solved yet, I’d like to point you towards Kevin Holman and his useful queries page:
Whilst these are for 2007, they are easily modified to work for 2012 and most will work without issues. Hopefully you’ll be able to muddle your way through creating your own query 🙂
If you can make a query that shows your result in objects, then you can change the “Select … from” part of your query, into “Select count(*) from” and you’ll get the number of rows the query returns. This you can then use as a Scalar display type in the SQL Plugin.
Below query shows you how many Alerts there are in the database with resolution state 249:
select count(*) from Alert.vAlertResolutionState where resolutionstate = 249