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

Re: Daily Report

$
0
0

Absolutely possible with PowerCLI.

 

This is probably incomplete from what you want, but should get you started:

$VMs = @("VM1", "VM2")

 

$Report = ""

 

foreach ($VMin$VMs)

{

   $Report += "<h1>$VM</h1>"

   $Report += Get-Stat -Entity (Get-VM $VM) -Start (Get-Date -Hour 8 -Minute 0 -Second 0).AddDays(-1) -Finish (get-date -Hour 18 -Minute 0 -Second 0).AddDays(-1) -Stat @("cpu.usage.average","mem.usage.average","cpu.ready.summation","disk.maxTotalLatency.latest","disk.usage.average") | Group-Object MetricID | Select Name, @{Name="Average";e={($_.Group | Measure-object -Average Value).Average}}, @{Name="Unit";e={$_.Group | Select -expandproperty Unit -First 1}} | ConvertTo-HTML -Fragment

}

 

ConvertTo-HTML -Body $Report | Out-File ("{0}\VMreport.html"-f$Env:Temp)

Invoke-Item ("{0}\VMreport.html"-f$Env:Temp)

Just replace the VM1, VM2 array values with your VM names (and add the rest, obviously)

 

You can run Get-StatType -Entity (Get-VM VMName) where VMName is the name of one of your VMs to get all available metrics.

 

You can also use the Send-MailMessage cmdlet to send this via email if you wish.


Viewing all articles
Browse latest Browse all 231085

Trending Articles



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