<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Esxi Hosts stat Report improvement in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969597#M112062</link>
    <description>&lt;P&gt;even If I only&amp;nbsp; run this against one host, it is failing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$statcpu = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-$days) -Finish (Get-Date)-MaxSamples 100 -stat cpu.usage.average # problem&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Get-Stat : 22.05.2023 09:46:00 Get-Stat The request channel timed out while waiting for a reply after 00:05:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding.&lt;BR /&gt;The time allotted to this operation may have been a portion of a longer timeout.&lt;BR /&gt;At line:9 char:16&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 07:54:17 GMT</pubDate>
    <dc:creator>vespavbb</dc:creator>
    <dc:date>2023-05-22T07:54:17Z</dc:date>
    <item>
      <title>Esxi Hosts stat Report improvement</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969589#M112057</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Luc,&lt;/P&gt;&lt;P&gt;can you help me out in this scipt. I have a Problem with the stat parameter. The script is not able to calculate the stat´s. Takes way to long. PS,&amp;nbsp; it is a hugh environment. I reduced -Maxsamples already to 100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$Cluster = "CL01"
$group = "DBhosts"
$drsgroup =  Get-DrsClusterGroup -name $group -Cluster $cluster

$days = 15

$Hosts = $drsgroup.Member


$allhosts = @()


foreach($vmHost in $hosts){
  $hoststat = "" | Select HostName, MemoryInstalled, MemoryAllocated, MemoryConsumed, MemoryUsage,MemoryFree, CPUMax, CPUAvg, CPUMin
  $hoststat.HostName = $vmHost.name
  
  $statcpu = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-$days) -Finish (Get-Date)-MaxSamples 100 -stat cpu.usage.average     # problem
  $statmemconsumed = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-$days) -Finish (Get-Date)-MaxSamples 10000 -stat mem.consumed.average
  $statmemusage = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-$days) -Finish (Get-Date)-MaxSamples 10000 -stat mem.usage.average
  $statmemallocated = Get-VMhost $vmHost.name | Select @{N="allocated";E={$_ | Get-VM | %{$_.MemoryGB} | Measure-Object -Sum | Select -ExpandProperty Sum}}
  $statmeminstalled = Get-VMHost $vmHost.name | select MemoryTotalGB
  $statmemoryfree = Get-VMhost $vmHost.name  | select @{N='Mem';E={[math]::Round(($_.MemoryTotalGB - $_.MemoryUsageGB),0)}} | select -ExpandProperty Mem

  $statmeminstalled = $statmeminstalled.MemoryTotalGB

  $cpu = $statcpu | Measure-Object -Property value -Average -Maximum -Minimum
  $memconsumed = $statmemconsumed | Measure-Object -Property value -Average
  $memusage = $statmemusage | Measure-Object -Property value -Average
  
  $CPUMax = "{0:N0}" -f ($cpu.Maximum)
  $CPUAvg = "{0:N0}" -f ($cpu.Average)
  $CPUMin = "{0:N0}" -f ($cpu.Minimum)
  $allocated = "{0:N0}" -f ($statmemallocated.allocated)
  $consumed = "{0:N0}" -f ($memconsumed.Average/1024/1024)
  $usage = "{0:P0}" -f ($memusage.Average/100)
  $installed = "{0:N0}" -f ($statmeminstalled)
  $free =  "{0:N0}" -f ($statmemoryfree)

  $CPUMax = $CPUMax.ToString() + " %"
  $CPUAvg = $CPUAvg.ToString() + " %"
  $CPUMin = $CPUMin.ToString() + " %"
  $MemoryInstalled = $installed.ToString() + " GB"
  $MemoryAllocated = $allocated.ToString() + " GB"
  $MemoryConsumed = $consumed.ToString() + " GB"
  $MemoryUsage = $usage.ToString()
  $MemoryFree = $free.ToString() + " GB"

  $hoststat.CPUMax = $CPUMax
  $hoststat.CPUAvg = $CPUAvg
  $hoststat.CPUMin = $CPUMin
  $hoststat.MemoryInstalled = $MemoryInstalled
  $hoststat.MemoryAllocated = $MemoryAllocated
  $hoststat.MemoryConsumed = $MemoryConsumed
  $hoststat.MemoryUsage = $MemoryUsage
  $hoststat.Memoryfree = $MemoryFree
  $allhosts += $hoststat
}
$allhosts | Select HostName, MemoryInstalled, MemoryAllocated, MemoryConsumed, MemoryUsage,MemoryFree, CPUMax, CPUAvg, CPUMin &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:18:48 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969589#M112057</guid>
      <dc:creator>vespavbb</dc:creator>
      <dc:date>2023-05-22T07:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Esxi Hosts stat Report improvement</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969591#M112058</link>
      <description>&lt;P&gt;If you are only interested in the aggregated values I would add the Instance parameter, especially when you have multi-core ESXi nodes.&lt;BR /&gt;&lt;BR /&gt;I would also consolidate all the Get-Stat calls into just one Get-Stat call, then split out the individual metrics via something like Group-Object.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:24:54 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969591#M112058</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-22T07:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Esxi Hosts stat Report improvement</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969597#M112062</link>
      <description>&lt;P&gt;even If I only&amp;nbsp; run this against one host, it is failing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$statcpu = Get-Stat -Entity ($vmHost)-start (get-date).AddDays(-$days) -Finish (Get-Date)-MaxSamples 100 -stat cpu.usage.average # problem&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Get-Stat : 22.05.2023 09:46:00 Get-Stat The request channel timed out while waiting for a reply after 00:05:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding.&lt;BR /&gt;The time allotted to this operation may have been a portion of a longer timeout.&lt;BR /&gt;At line:9 char:16&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:54:17 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969597#M112062</guid>
      <dc:creator>vespavbb</dc:creator>
      <dc:date>2023-05-22T07:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Esxi Hosts stat Report improvement</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969599#M112064</link>
      <description>&lt;P&gt;You can try increasing the&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;WebOperationTimeoutSeconds&lt;/STRONG&gt; value (default 300 seconds) with the &lt;A href="https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/set-powercliconfiguration/" target="_blank" rel="noopener"&gt;Set-PowerCLICOnfiguration&lt;/A&gt; cmdlet.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 08:03:31 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Esxi-Hosts-stat-Report-improvement/m-p/2969599#M112064</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-22T08:03:31Z</dc:date>
    </item>
  </channel>
</rss>

