Esxtop is a powerfull CLI tool on ESX server to take a look at performance counters of an ESX system, including the resources that the Virtual Machines (VMs) take. In this short walkthrough I will explain in a general matter how to setup performance logging to a separate Windows share from an ESX server.
First of all I presume you are a little familiar with Windows, Linux, the ESX CLI and esxtop as a command. Do not worry, I will point out most of the command switches we are going to need, but at least you should know what esxtop is used for.
Create the Windows share
- Connect to a Windows PC or server with sufficient free space (logging can easily take a few MegaBytes per minute / ESX server).
-
Create a new local user account
- Provide a username, will we using “esxlog” in this example
- Provide a password and make sure the user does not have to change the password at the next login.
-
Create a folder an share
- Create a folder name “esxlog” on the host (example 2003 server)
-
Share the folder by right clicking it, pick “Properties” and the tab “Sharing”
- Select “Share this folder” and share the folder as “esxlog’
- Click “Permissions”
- Remove “Everyone”
- Add the newly created user “esxlog”, and give Full Control.
- Close all dialogs
-
Mount the share on ESX
- Log into the Virtual Center Client and connect to the ESX host logging will be configured on.
- Log into the esx server using ssh as root (if there is no root account prefix all following commands with sudo).
- Mounting and testing the share
- Create a directory on the ESX server in the “mnt”directory
mkdir /mnt/esxlogfiles
- Mount the Windows share on the ESX host using:
-
mount -t smbfs -o username=esxlog //
/esxlog /mnt/esxlogfiles - Provide the password when prompted
- Create a testfile on the share:
touch /mnt/esxlogfiles/test.log
- Check the Windows host to see if the file is created there.
Configure esxtop
- CPU data – c
- Memory data – m
- Network data – n
- Disk – d
- ESX disk devices – u
- Virtual Machine disk devices – v
You can modify the columns shown in the various screens by pressing the letter f. A detailed explanation of all columns can be viewed in the esxtop helpfile.
Type the followingto show the help.
man esxtop
You can change the logfile interval by pressing the letter s. Enter a number of seconds to change. The minimum is 2.
Starting esxtop in batch mode
- -b To start in batchmode (obligatory)
- -d
The number of seconds between the logging intervals - -n
The number of iterations - > Pipe the output to a file (on the mounted Windows share)
Combining these options gives us the following esxtop batch mode example:
esxtop –b –d 3 –n 20 >/mnt/esxlogfiles/.csv
Running this should provide a logfile on the Windows share with 1 minute of logging data (20 iterations of 3 a second interval)
Check the logfile and verify it provides the data you want to collect! Esxtop always provides generic data like processor, memory and swapfile logdata.
Also make sure the time on the server is correctly. Preferably a NTP server.
Starting esxtop in the background
When you want to start esxtop in the background, including the option to completely quit your session, prefix the command with nohup and add the “&” to the end of the command line. This looks like:
nohup esxtop –b –d 3 –n 20 >/mnt/esxlogfiles/.csv &
Do not forget to change the number of interations!
Schedule esxtop to start logging
A third option to start the esxtop in batchmode is to use the crontab to schedule it.
Presumed you are still logged in to the CLI, do the following:
- Open the default crontab for the current user (root!) by typing
crontab –e
00 12 * * * esxtop –b –d 3 –n 20 >/mnt/esxlogfiles/.csv
If you only want to run this command a limited number of times do not forget to remove the entry. Again substitute the number of iterations for the number you would like the logging to run.
Log file analysis
When logging has finished you can view the log file using Microsoft excel of Permon. You can import the CSV file into these applications.
Perfmon example
- Start perfmon (start, run, perfmon)
- Select “Performance Monitor”, en right click it.
- Click “Properties”
- Goto the tab “Source”
- Click logfiles and choose “Add”
- Select the created logfile and click “Open”
- Close the dialog by clicking OK.
- Goto the tab “Data” and click “Add”
- Select the counter you would like to see, en add them to the view
- Enjoy too much data in a graph. ;-)
Original Source: http://www.b3rg.nl/blog/blog-it/performance-logging-on-esx-using-esxtop.html
No comments:
Post a Comment