Hello,
I'm new to scripting, Kindly assist me on getting CPU,Memory for Cluster & Esxi Host's under the Cluster in the below format
Cluster | Esxi Host Name | CPU GHz Capacity | CPU GHz Used | CPU GHz Free | Memory Capacity GB | Memory Used GB | Memory Free GB | TimeStamp |
Thanks,
Kumar
What did you find when you did a search in this area of VMTN? (this topic will have been covered many times before)
Hi Scott,
I was able to pull few information using the previous Script, But I was unable to pull in required format as below.
Cluster | Esxi Host Name | CPU GHz Capacity | CPU GHz Used | CPU GHz Free | Memory Capacity GB | Memory Used GB | Memory Free GB | TimeStamp |
this is the link I tried few options.
If can assist me on that I will be thankful.
Regards,
Kumar
Just providing a link to another post is not really saying what your problem is.
That other post has 90% of the information you requested.
What is missing?
What did you try, and what didn't work?
And btw, you never replied on your other thread.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
Yes, the link as information, But I required all cluster's & Esxi Host & Timestamp to be added.
Cluster-Esxi-Timestamp, Kindly help me to add those cmdlet to Script..Please.
Previous one as suggested, I'm working on it...Once I do it...I will surely thank you on that thread.
As always you're so much helpful.
Thanks,
Kumar
Try something like this
$time = Get-Date
Get-Cluster -PipelineVariable cluster |
Get-VMHost|
Select @{N='Cluster';E={$cluster.Name}},
@{N='VMHost';E={$_.Name}},
@{N='CPU GHz Capacity';E={[math]::Round($_.CpuTotalMhz/1000,2)}},
@{N='CPU GHz Used';E={[math]::Round($_.CpuUsageMhz/1000,2)}},
@{N='CPU GHz Free';E={[math]::Round(($_.CpuTotalMhz - $_.CpuUsageMhz)/1000,2)}},
@{N='Memory Capacity GB';E={[math]::Round($_.MemoryTotalGB,2)}},
@{N='Memory Used GB';E={[math]::Round($_.MemoryUsageGB,2)}},
@{N='Memory Free GB';E={[math]::Round(($_.MemoryTotalGB - $_.MemoryUsageGB),2)}},
@{N='Timestamp';E={$time}} |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Dear Lucd,
It worked....!! Thanks...!!
It's really admirable, As always you help other's and make sure it get's resolved.
You're the captain of this community.
Thanks a lot ..!!
Regards,
Kumar
Hi,
How can I convert the output into percentage (%) ..Please.
Regards,
Kumar.
Used/Capacity*100
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
Below is changes made for only ( Free Memory & CPU ) as per your instructions,
$time = Get-Date
Get-Cluster -PipelineVariable cluster |
Get-VMHost|
Select @{N='Cluster';E={$cluster.Name}},
@{N='VMHost';E={$_.Name}},
@{N='CPU GHz Capacity';E={[math]::Round($_.CpuTotalMhz/1000,2)}},
@{N='CPU GHz Used';E={[math]::Round($_.CpuUsageMhz/1000,2)}},
@{N='CPU GHz Free %';E={[math]::Round(($_.CpuTotalMhz - $_.CpuUsageMhz)/1000,2)/100}},
@{N='Memory Capacity GB';E={[math]::Round($_.MemoryTotalGB,2)}},
@{N='Memory Used GB';E={[math]::Round($_.MemoryUsageGB,2)}},
@{N='Memory Free %';E={[math]::Round(($_.MemoryTotalGB - $_.MemoryUsageGB),2)/100}},
@{N='Timestamp';E={$time}}|
Export-Csv -Path c:\temp\ramdisk\Utilisationreport3.csv -NoTypeInformation -UseCulture
Below is the Ooutput.
CPU GHz Capacity | CPU GHz Used | CPU GHz Free % | Memory Capacity GB | Memory Used GB | Memory Free % | Timestamp |
79.8 | 54.76 | 0.2504 | 1023.65 | 737.62 | 2.8603 | 04-12-2020 14:20 |
79.8 | 57.71 | 0.2209 | 1023.65 | 459.15 | 5.645 | 04-12-2020 14:20 |
Kindly let me whether OUT is correct, If yes... How I place percentage symbol next to Value as per Below
CPU GHz Capacity | CPU GHz Used | CPU GHz Free % | Memory Capacity GB | Memory Used GB | Memory Free % | Timestamp |
79.8 | 54.76 | 0.25% | 1023.65 | 737.62 | 2.86% | 04-12-2020 14:20 |
79.8 | 57.71 | 0.22% | 1023.65 | 459.15 | 5.65% | 04-12-2020 14:20 |
Thanks,
Kumar
Hi,
Kindly can you help me to convert the same into percentage.
Regards,
Kumar.