Issue
Today I face out a singular issue, concerning networks micro disconnection and the needs verify information on the physical NICs regarding packet drops and so on ..
To do that, I wrote a powershell script, available below.
It is enough just replace the variables<VCENTER_FQDN_or_IP> with it's own vCenter (FQDN or IP) references and <CLUSTER_NAME> with the name of the Cluster where the ESXi Hosts are placed.
Connect-VIServer -Server <VCENTER_FQDN_or_IP> $hosts = Get-Cluster <CLUSTER_NAME> |Get-VMHost $Report = @() foreach($ESXi in $hosts){ $esxcli = get-vmhost $ESXi | Get-EsxCli $nics = $esxcli.network.nic.list.Invoke() foreach($pNic in $nics){ $tempModule=@{} $tempModule.Name = $ESXi.name $tempModule.NIC_Name = $pNic.Name $tempModule.NIC_Link = $pNic.Link $tempModule.NIC_LinkStatus = $pNic.LinkStatus $tempModule.NIC_Driver = $pNic.Driver $tempModule.NIC_Duplex = $pNic.Duplex $tempModule.NIC_MACAddress = $pNic.MACAddress $tempModule.NIC_MTU = $pNic.MTU $tempModule.NIC_Speed = $pNic.Speed $vmnicstats = $esxcli.network.nic.stats.get($pNIC.Name) $tempModule.vmnic_Broadcastpacketsreceived = $vmnicstats.Broadcastpacketsreceived $tempModule.vmnic_Broadcastpacketssent = $vmnicstats.Broadcastpacketssent $tempModule.vmnic_Bytesreceived = $vmnicstats.Bytesreceived $tempModule.vmnic_Bytessent = $vmnicstats.Bytessent $tempModule.vmnic_Multicastpacketsreceived = $vmnicstats.Multicastpacketsreceived $tempModule.vmnic_Multicastpacketssent = $vmnicstats.Multicastpacketssent $tempModule.vmnic_Packetsreceived = $vmnicstats.Packetsreceived $tempModule.vmnic_Packetssent = $vmnicstats.Packetssent $tempModule.vmnic_ReceiveCRCerrors = $vmnicstats.ReceiveCRCerrors $tempModule.vmnic_ReceiveFIFOerrors = $vmnicstats.ReceiveFIFOerrors $tempModule.vmnic_Receiveframeerrors = $vmnicstats.Receiveframeerrors $tempModule.vmnic_Receivelengtherrors = $vmnicstats.Receivelengtherrors $tempModule.vmnic_Receivedmissederrors = $vmnicstats.Receivedmissederrors $tempModule.vmnic_Receiveovererrors = $vmnicstats.Receiveovererrors $tempModule.vmnic_Receivepacketsdropped = $vmnicstats.Receivepacketsdropped $tempModule.vmnic_Totalreceiveerrors = $vmnicstats.Totalreceiveerrors $tempModule.vmnic_Totaltransmiterrors = $vmnicstats.Totaltransmiterrors $tempModule.vmnic_TransmitFIFOerrors = $vmnicstats.TransmitFIFOerrors $tempModule.vmnic_Transmitabortederrors = $vmnicstats.Transmitabortederrors $tempModule.vmnic_Transmitcarriererrors = $vmnicstats.Transmitcarriererrors $tempModule.vmnic_Transmitheartbeaterrors = $vmnicstats.Transmitheartbeaterrors $tempModule.vmnic_Transmitpacketsdropped = $vmnicstats.Transmitpacketsdropped $tempModule.vmnic_Transmitwindowerrors = $vmnicstats.Transmitwindowerrors $temp = New-Object -TypeName PSObject -Property $tempModule $Report += $temp } } $Report | Select * | Sort-Object -Property Name | Out-Gridview
That's it.
Nessun commento:
Posta un commento