Last week I have faced challenge in responding to HP support (ITRC) thread regarding collecting Network utilization for Operation Manger to evaluate it against threshold.

Infrastructure SPI contain some policies for Monitoring network utilization but it is quite complicated (but efficient) as it has various  mathematical calculations.

Any way the script I have provided was just for calculating the utilization based on two factors total bytes transferred per second and the bandwidth.

We can get this data using WMI through “Win32_PerfFormattedData_TCPIP_NetworkInterface” class located on namespace “rootCIMV2”
We can use the attributes below to match factors stated above:


Network utilization calculation:
BytesTotalPerSec / CurrentBandwidth * 100

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "RootCIMV2")
Set colItems = objWMIService.ExecQuery _
("select * from Win32_PerfFormattedData_TCPIP_NetworkInterface ")
For Each objItem in colItems
bytesTotal = objitem.BytesTotalPersec * 8
bandwidth = objItem.CurrentBandwidth
result = FormatNumber(( bytesTotal / bandwidth) * 100)
output = objitem.Name & " Network Bandwidth: " & result & " % Utilized"
WScript.Echo output

Screenshot of the output.



Previous Article
Next Article