Technical guide to collect CPU performance metrics on VMware ESXi using esxtop, esxcli, and vsish commands
How to Collect CPU Performance Information on ESXi
This guide provides command-line methods to monitor and analyze CPU performance on VMware ESXi hosts using built-in tools such as esxtop, esxcli, and vsish.
Prerequisites
- SSH access to the ESXi host
- Administrative privileges
- Basic familiarity with ESXi CLI tools
1. Monitor CPU Usage with esxtop
The esxtop utility provides real-time performance monitoring.
Launch esxtop
esxtop
Switch to CPU View
Press:
p
Add Advanced CPU Metrics (%A/MPERF)
- Press
fto open field selection - Press
fagain - Press
Enterto confirm
This enables additional CPU performance counters for deeper analysis.
2. View CPU Hardware Information
Use esxcli to display detailed CPU hardware information:
esxcli hardware cpu list
This command provides details such as:
- CPU model
- Core count
- Thread count
- Frequency
3. Retrieve Per-CPU Performance Data Using vsish
Check a Single CPU Core
vsish -e get /power/pcpu/0/perf
This displays performance metrics for CPU core 0.
Check All CPU Cores
vsish -e get $(printf 'power/pcpu/%sperf ' $(vsish -e ls power/pcpu))
This command retrieves performance data for all physical CPU cores.
4. Calculate Average CPU Performance
Use the following command to calculate the average CPU performance percentage across all cores:
vsish -e get $(printf 'power/pcpu/%sperf ' $(vsish -e ls power/pcpu)) | awk '/current/ {cpus+=1; total+=$6} END {print total/cpus "%"}'
This processes the vsish output and calculates the average "current" CPU performance.
5. Identify Maximum CPU Performance
To find the highest CPU performance value across all cores:
vsish -e get $(printf 'power/pcpu/%sperf ' $(vsish -e ls power/pcpu)) | awk '/current/ {if($6 > max) max=$6} END {print max}'
This identifies the peak CPU utilization value among all cores.
Best Practices
- Use
esxtopfor real-time monitoring during performance issues - Use
vsishfor detailed low-level metrics - Correlate CPU metrics with workload activity
- Monitor both average and peak CPU usage
Summary
By combining esxtop, esxcli, and vsish,
administrators can gain both high-level and low-level visibility into CPU performance on ESXi hosts.