In a post yesterday there was a script to ping some node, the script uses WMI to ping.
Did some testing, and… Why did I write a script when you can use the built in WMI-support to do the same thing?
Why (not) a script?
OK, there is one thing that (afaik) you can’t do with WMI-queries… JOIN.
I would like to do some sort of query that puts out CSName from Win32_OperatingSystem along with StatusCode and ResponseTime from Win32_PingStatus, but… I can’t figure out how.
Ok?
Since you have the performance mapper to point out Object, Counter and so on you can’t make a simple WMI-query that allows you to get the name of the agent. And if you can’t get that to work you will get a mix of multiple agents performance-data on one counter…
The script returns serverToPingFrom, thats what I’m missing.
The solution
When I first looked at it… I only looked at the WMI-query and didn’t think about what SCOM and the performance mapper can do.
The solution is to name the Counter with use of some data that SCOM already know.
Yada yada yada… on to the script!
Go to OM-Console -> Authoring -> Management Pack Objects -> Rules -> New… -> Collection Rules \ Performance based \ WMI performance
A few next-clicks and then paste the following:
WMI Namespace
root\cimv2
Query
SELECT * FROM Win32_PingStatus WHERE address = ’192.168.0.10′ AND BufferSize=4096 AND Timeout=1000
Perfomance mapper
Object = WMIPingRoundtrip
Counter = $Target/Property[Type="System!System.Entity"]/DisplayName$
Instance = $Data/Property[@Name='Address']$
Value = $Data/Property[@Name='ResponseTime']$