Disclaimer: You should try to limit the use of these interfaces for statistics collection or debugging/troubleshooting purposes as there is a certain amount of overhead when running these commands. It is also important to note that since the output is based on the implementer of the service, there is no guarantee that output would not change from one release to the other.
The first step is to get a reference to the vscsiStats service via the Service Manager (must connect directly to an ESXi 5. host, this is not supported when connecting to vCenter Server) and to invoke an operation for vscsiStats, you will need to use the ExecuteSimpleCommand. For vscsiStats, there are four valid operations:
- StartVscsiStats
- FetchAllHistograms
- ResetVscsiStats
- StopVscsiStats
StartVscsiStats
This operation starts the vscsiStats collection for ALL virtual machines residing on your ESXi hosts. This is exactly the same operation if you were to only specify the -s option to the vscsiStats command-line. Here is a screenshot of the "start" operation implemented in the script:You should see a response of OK from the output and this would indicate the vscsiStats collection has started.
FetchAllHistograms
The <VM> tag denotes the details about each Virtual Machine:
- VM Display Name
- VM VMX Configuration Path
- VM BIOS UUID
- vCenter Server UUID
VSCSIVsi_DistanceHistogram: Histogram: distance (in LBNs) between successive commands - VSCSIVsi_DistanceLast16Histogram: Histogram: distance (in LBNs) between each command from the closest of previous 16
- VSCSIVsi_DistanceReadsHistogram: Histogram: distance (in LBNs) between successive Read commands
- VSCSIVsi_DistanceWritesHistogram: Histogram: distance (in LBNs) between successive Write commands
- VSCSIVsi_IoLatencyHistogram: Histogram: latency of IOs in Microseconds (us)
- VSCSIVsi_IoLatencyReadsHistogram: Histogram: latency of Read IOs in Microseconds (us)
- VSCSIVsi_IoLatencyWritesHistogram: Histogram: latency of Write IOs in Microseconds (us)
- VSCSIVsi_IoLengthHistogram: Histogram: IO lengths of commands
- VSCSIVsi_IoLengthReadsHistogram: Histogram: IO lengths of Read commands
- VSCSIVsi_IoLengthWritesHistogram: Histogram: IO lengths of Write commands
- VSCSIVsi_OutstandingIOsHistogram: Histogram: number of outstanding IOs when a new IO is issued
- VSCSIVsi_OutstandingIOsReadsHistogram: Histogram: number of outstanding Read IOs when a new Read IO is issued
- VSCSIVsi_OutstandingIOsWritesHistogram: Histogram: number of outstanding Write IOs when a new Write IO is issued
- Histogram: latency of IO interarrival time in Microseconds (us)
- Histogram: latency of IO interarrival time for Reads in Microseconds (us)
- Histogram: latency of IO interarrival time for Writes in Microseconds (us)
ResetVscsiStats
This operation will reset the vscsiStats collection similar to the -r option in the vscsiStats command-line. Here is a screenshot of the "reset" operation implemented in the script:StopVscsiStats
This operation will stop the vscsiStats collection similar to the -x option in the vscsiStats command-line. Make sure you perform this operation once you are done retrieving your vscsiStats data. Here is a screenshot of the "stop" operation implemented in the script:In addition to the four operations, you can also save the output to a file by specifying the --output option along with the name of the file. vscsiStats is an extremely useful tool to help vSphere administrators profile their virtual machine's IO workload and now you can easily collect this information using the vSphere API. Some really cool things you can do with this data is to create some nifty graphs such as the ones here and here.

No comments:
Post a Comment