Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 201333

Re: [Script / Code sample Request] Get Total Network throughput for given set of ESXi hosts or pNICs

$
0
0

Try it like this

 

$esx=Get-VMHost
$stat="net.received.average","net.transmitted.average"
$start= (Get-Date).AddMinutes(-30)

Get-Stat-Entity$esx-Stat$stat-Start$start-Realtime|
Group-Object-Property {$_.Entity.Name} |%{
 
$record=New-ObjectPSObject-Property@{
   
CollectionTime=$_.Group[0].Timestamp
   
Host=  $_.Name
  }
 
$_.Group|where {$_.Instance-match"vmnic"} |
   
Group-Object-PropertyInstance|%{
   
$RxValue=$_.group|where {$_.MetricId-eq"net.received.average"} |
     
Measure-Object-PropertyValue-Average-Maximum
   
$TxValue=$_.group|where {$_.MetricId-eq"net.transmitted.average"} |
     
Measure-Object-PropertyValue-Average-Maximum
   
Add-Member-InputObject$record-Name ($_.Name+"AvgRx (KBps)") -Value ([math]::Round($RxValue.Average,1)) -MemberTypeNoteProperty
   
Add-Member-InputObject$record-Name ($_.Name+"AvgTx (KBps)") -Value ([math]::Round($TxValue.Average,1)) -MemberTypeNoteProperty
   
Add-Member-InputObject$record-Name ($_.Name+"MaxRx (KBps)") -Value ([math]::Round($RxValue.Maximum,1)) -MemberTypeNoteProperty
   
Add-Member-InputObject$record-Name ($_.Name+"MaxTx (KBps)") -Value ([math]::Round($RxValue.Maximum,1)) -MemberTypeNoteProperty
  }
 
$record
}

Viewing all articles
Browse latest Browse all 201333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>