We made a quick and dirty little PowerShell script that we are executing on all of our polling engines via a PowerShell component monitor.
$ScriptBlock = { ( netstat -anob ) | Where-Object { $_ -like '*svchost.exe*' } | Measure-Object | Select-Object -ExpandProperty Count}
$count = Invoke-Command -ComputerName '${Node.Caption}' -Credential '${CREDENTIAL}' -ScriptBlock $ScriptBlock
Write-Host "Statistic:" $count
Write-Host "Message: Total connections " $count
(A reminder to max sure your template is set to x64 and the component is set to local execution with impersonation!)
When we try and graph the statistic data though, it fails. But it only fails for the new, custom chart widget (the one that let's you dynamically shift the time period, slide the period focus, etc.) It works using the old-style Multiple Object Chart, but that chart has a limited set of data summation options.
Has anyone else run into the same or similar problems with graphing this data series? I verified that we could see the data series via this SWQL query and it works just like any of the other data series. (Yes, our component is called svchost.exe connection count)
SELECT
cs.component.application.node.caption
,cs.ComponentStatisticData
,CONCAT('http:\\monitoring.cardinalhealth.net',cs.component.DetailsURL) as URL
FROM Orion.APM.CurrentStatistics cs
WHERE
ComponentName = 'svchost.exe connection count'
ORDER BY cs.ComponentStatisticData DESC