ESXTOP can be very good to tool to see the live stats and usage of the Physical host and its components, but more often than not, we would like to use that data to plot graphs or even save the data to examine it later.
This brings us to the most important use case of ESXTOP is to run ESXi in batch mode.
Batch mode provides us a way to collect esxtop stats from a physical ESXi host and analyze it on a Windows machine using Perfmon.
Capture the Data:
First thing would be capture only the relevant info and omit all the metrics you don't need.
Use ‘f’ to ADD/Remove Fields
Use ‘o’ to change the order of Metrics
Use ‘W’ to save the settings that you just edited.
Caution: If you don't input a file name, the default settings will be saved as such.
We are ready to run the esxtop in batch mode.
esxtop -b -d 2 -n 100 > esxtop.csv
b=batch mode
d=delay
n=No of Iterations
a=all Metrics
Usually capturing esxtop for an extended period of time can result in a large file. In order to avoid this, we can zip the file too.
esxtop -b -a -d 2 -n 100 | gzip -9c > esxtop.csv.gz
Analyze:
Copy the CSV file to the Windows machine to analyze the captured data.
(1) Run perfmon;
(2) Type "Ctrl + L" to view log data;
(3) Add the file to the "Log files" and click OK;
(4) Choose the counters to show the performance data. Each batch mode counter has a category name (listed as a performance object in perfmon) and a counter name (listed in the counter list in perfmon).
Note: The counter names on esxtop is different from the ones in interactive mode listed.
Refer to this link for more information