One request I received from a customer the other day was to find out which services were being monitored by SCOM. It is a simple request, but because of the way SCOM was built, hierarchically, with classes objects, targets, etc, it is actually hard to easily pin-point something like this.
You could use the handy “Show running rules and Monitors for this Health Services” task suggested here but it will give you too much information.
As usual. There is a way. And it involves querying the SCOM database. No, no, don’t go away. It is quick and almost painless.
First, quick review: SCOM works with Monitors, monitor types, probes, targets. In this case, the easiest way was to find out all the monitor instances of a certain monitor type. Here’s a query against the SQL Views in the SCOM DB that will give you all the monitor types with Service in the name:
WHERE NAme like ‘%NTService%’ And LanguageCode = ‘ENU’
You should get something like that:
Try changing %NTService% to just ‘Service’ and you may find something that interests you. I will keep going with these only.
Now I have the 3 IDs that interest me and I’m not afraid of using them. (ID number 2 is a ServiceManager monitor, so, it doesn’t apply).
So, the final query, that will join the Basemanagedentity, Monitor and Monitor type tables will be like this:
SELECT Distinct ManagedEntityGenericView.Path,StateView.MonitorName, StateView.OperationalStateName, StateView.LastModified
FROM StateView INNER JOIN
ManagedEntityGenericView ON StateView.BaseManagedEntityId = ManagedEntityGenericView.BaseManagedEntityId INNER JOIN
MonitorView ON StateView.MonitorId = MonitorView.Id
WHERE (MonitorView.MonitorTypeId = ‘3CBB5B37-0101-0EED-E7F2-1F596E7EB7C2’)
or (MonitorView.MonitorTypeId = ‘0B988C7F-B268-CFBB-953C-4E2A5BE611D6′) or (MonitorView.MonitorTypeId = ’55CFDA43-D3E8-3881-E0A6-EAC3BC9E45EB’)
ORDER BY ManagedEntityGenericView.Path
You should see something like this:
A quick report on a pivot table can show the service monitors per box in your environment:
It might require some massaging to get the proper classes showing (you can see SQL is in the mix) but it is a good start!
Hope this helps