VMware Cloud Community
Gonzouk
Enthusiast
Enthusiast

Daily Report

Hello,

We have 8 x 5.5 ESXi hosts and vCenter.

I'm not sure if this is even possible, we have about 150 guest vms, but I have been asked to create a daily report regarding a group of just 20 Citrix servers.  I need to get the average important stats between the hours of 8am-6pm like this:

Server 1

avg cpu

avg mem

avd disk latency

avg cpu ready

avg disk writes

Server 2

avg cpu

avg mem

avd disk latency

avg cpu ready

avg disk writes

etc..

Please advise, maybe I havent included some important stats that you can mention?

Andy

0 Kudos
1 Reply
sneddo
Hot Shot
Hot Shot

Absolutely possible with PowerCLI.

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

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

$Report = ""

foreach ($VM in $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.

0 Kudos