This document describes the steps to run an inventory discovery on your
VMware environment using the Migration Center discovery client CLI.

## Before you begin

1. Review the [requirements for downloading and running the `mcdc` CLI](https://docs.cloud.google.com/migration-center/docs/review-collector-cli-requirements).
2. Complete the steps to [download `mcdc` CLI](https://docs.cloud.google.com/migration-center/docs/download-collector-cli).

## Run an inventory discovery on VMware using vSphere API

Use the vSphere API to collect data about all VMs in a vCenter visible to
the user running the `mcdc` CLI. You can also scope a
discovery to a specific folder, cluster, or data center.

### Configure vCenter

If you plan to export the collected data to Migration Center,
before you run an inventory discovery, you need to configure your vCenter
environment.
The data you collect with `mcdc` CLI, in fact, depend on
the settings for statistics in vCenter.

vCenter supports four levels of statistics:

- Level 1 exposes only CPU and memory performance.
- Level 2 exposes the network performance.
- Level 3 exposes input/output operations per second (IOPS).
- Level 4 exposes all the available metrics.

For a detailed list of the available metrics for all statistics levels, see
[Data collection levels](https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/7-0/vcenter-configuration/configuring-vcenter-server-using-the-vsphere-client/configuring-vcenter-server-in-the-vsphere-client/configuring-statistics-settings-in-the-vsphere-client/data-collection-levels.html).

By default, the statistics level is set to level 1. Levels 1 and 2 let you
collect partial data about your infrastructure, while level 3 lets you
collect everything you need to generate a complete total cost of ownership (TCO)
report.
After the statistics level is changed in vCenter, it might take several
hours for performance data to become available.

For more information on how to change statistics levels in vCenter, see
[Configure statistics collection intervals in the vSphere client](https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/7-0/vcenter-configuration/configuring-vcenter-server-using-the-vsphere-client/configuring-vcenter-server-in-the-vsphere-client/configuring-statistics-settings-in-the-vsphere-client/configure-statistics-intervals-for-vcenter-server-in-the-vsphere-client.html).

### Run the discovery

1. In the command line terminal, change to the directory where you downloaded the `mcdc` CLI.
2. Run the discovery:


   ### Linux

   <br />

   ```
   ./mcdc discover vsphere -u USERNAME --url https://VSPHERE_URL
   ```

   <br />

   ### Windows

   <br />

   ```
   mcdc.exe discover vsphere -u USERNAME --url https://VSPHERE_URL
   ```

   <br />

   <br />

   Replace the following:
   - <var translate="no">USERNAME</var>: your vCenter username
   - <var translate="no">VSPHERE_URL</var>: the URL for your vCenter Server instance or the vSphere Client

   To avoid a certificate check for connecting to the vCenter,
   include the `-i` (insecure) flag in the command.
3. When prompted, enter the vCenter password.

After the inventory discovery is complete, the collected data is stored in the
local database.

### Scope a discovery

- Run the discovery at the root:


  ### Linux

  <br />

  ```
  ./mcdc discover vsphere --url https://VSPHERE_URL -u USERNAME --path /
  ```

  <br />

  ### Windows

  <br />

  ```
  mcdc.exe discover vsphere --url https://VSPHERE_URL -u USERNAME --path /
  ```

  <br />

  <br />

- Run the discovery at a specific folder:


  ### Linux

  <br />

  ```
  ./mcdc discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER/vm/FOLDER
  ```

  <br />

  ### Windows

  <br />

  ```
  mcdc.exe discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER/vm/FOLDER
  ```

  <br />

  <br />

  Replace the following:
  - <var translate="no">DATACENTER</var>: the name of the data center
  - <var translate="no">FOLDER</var>: the path to the folder
- Run the discovery at a specific cluster:


  ### Linux

  <br />

  ```
  ./mcdc discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER/host/CLUSTER
  ```

  <br />

  ### Windows

  <br />

  ```
  mcdc.exe discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER/host/CLUSTER
  ```

  <br />

  <br />

  Replace the following:
  - <var translate="no">CLUSTER</var>: the name of the cluster
- Run the discovery at a specific data center:


  ### Linux

  <br />

  ```
  ./mcdc discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER
  ```

  <br />

  ### Windows

  <br />

  ```
  mcdc.exe discover vsphere --url https://VSPHERE_URL -u USERNAME --path DATACENTER
  ```

  <br />

  <br />

To avoid a certificate check for connecting to the vCenter, include the
`-i` (insecure) flag in the command.

## Run an inventory discovery on VMware using RVTools

For VMs running on VMware, the `mcdc` CLI lets you analyze
the XLSX report files generated with
[RVTools](https://www.robware.net/rvtools/).

- Collect data based on your existing RVTools export:


  ### Linux

  <br />

  ```
  ./mcdc discover rvtools REPORT_NAME.xlsx
  ```

  <br />

  ### Windows

  <br />

  ```
  mcdc.exe discover rvtools REPORT_NAME.xlsx
  ```

  <br />

  <br />

  Replace <var translate="no">REPORT_NAME</var> with the path to the XLSX generated
  with RVTools.

However, this method has following limitations:

- The `mcdc` CLI doesn't support tables generated with the `--DBColumnNames` flag in RVTools.
- The `mcdc` CLI doesn't support exporting the data collected using this method to Migration Center. However, you can use it to [run an offline assessment](https://docs.cloud.google.com/migration-center/docs/run-offline-assessment).

## What's next

- Learn how to [run a guest discovery](https://docs.cloud.google.com/migration-center/docs/run-guest-discovery).
- Learn how to [export collected data to Migration Center](https://docs.cloud.google.com/migration-center/docs/export-collected-data).