What is the state of a particular monitor for all of my objects?
I saw an interesting question today on one of the newsgroups. Basically the question was "How can I find out the state of a particular monitor across all the objects that I have". Unfortunately, a state view in the OpsMgr console doesn’t provide you this information. Instead it provides you the overall state of objects of a particular type (Logical Disks for example). However the SDK has a very convenient function to accomplish this. The attached script takes two parameters:
MonitorName - This is the name of monitor as it appears in the UI
TargetName - This is the name of the target/class as it appears in the UI.
Here is how you run the cmdlet:
1 - Open the OpsMgr CommandShell
2 - Type the following: C:\InstanceMonitorState.ps1 -monitorName:'Logical Disk Free Space' -targetName:'Windows Server 2008 Logical Disk'
Here is the output the you will see:
dc1.contoso.com;E: - Success - 9/11/2008 9:29:50 PM
dc2.contoso.com;C: - Success - 9/11/2008 8:24:17 PM
dc1.contoso.com;C: - Success - 9/11/2008 9:29:49 PM