This tool uses the govmomi library to list available datastore clusters with their datastores per VMware cluster. It provides a comprehensive view of your VMware storage organization.
- Lists all VMware clusters in your environment
- For each cluster, shows all datastore clusters (storage pods) and their datastores
- Lists standalone datastores (not in any datastore cluster)
- Shows capacity and free space information for each datastore
- Go 1.20 or higher
- Access to a VMware vSphere environment
- Credentials with permissions to view datastores and clusters
-
Clone the repository:
git clone https://github.com/kelaro/godcinfo.git cd godcinfo -
Install dependencies:
make deps
You can run the tool in two ways:
export VSPHERE_URL="https://vcenter.example.com/sdk"
export VSPHERE_USERNAME="admin"
export VSPHERE_PASSWORD="password"
export VSPHERE_DATACENTER="your-datacenter-name"
make runmake build
./godcinfo -url="https://vcenter.example.com/sdk" -username="admin" -password="password" -datacenter="your-datacenter-name"Or use the provided make target:
VSPHERE_URL="https://vcenter.example.com/sdk" VSPHERE_USERNAME="admin" VSPHERE_PASSWORD="password" VSPHERE_DATACENTER="your-datacenter-name" make run-with-env-url: vSphere URL (required)-username: vSphere username (required)-password: vSphere password (required)-datacenter: vSphere datacenter name (if not specified, the tool will list available datacenters)-insecure: Skip verification of server certificate (default: true)
If your password contains special characters like !, $, &, etc., you can use one of these methods:
-
Use single quotes to wrap the password:
./godcinfo -url="https://vcenter.example.com/sdk" -username="admin" -password='P@ssw0rd!'
-
Escape special characters with a backslash:
./godcinfo -url="https://vcenter.example.com/sdk" -username="admin" -password="P@ssw0rd\!"
-
Use environment variables (recommended for security):
export VSPHERE_PASSWORD="P@ssw0rd!" ./godcinfo -url="https://vcenter.example.com/sdk" -username="admin"
Using datacenter: DC01
Cluster: Cluster01
-----------------
Datastore Cluster: StoragePod01
- Datastore01 (Capacity: 2048.00 GB, Free: 1024.00 GB)
- Datastore02 (Capacity: 4096.00 GB, Free: 2048.00 GB)
Datastore Cluster: StoragePod02
- Datastore03 (Capacity: 1024.00 GB, Free: 512.00 GB)
Standalone Datastores:
- Datastore04 (Capacity: 8192.00 GB, Free: 4096.00 GB)
Cluster: Cluster02
-----------------
No datastore clusters found for this cluster
Standalone Datastores:
- Datastore05 (Capacity: 2048.00 GB, Free: 1024.00 GB)
To build the application:
make buildmake build- Build the applicationmake run- Run the application (using environment variables or flags)make run-with-env- Run with environment variablesmake clean- Remove build artifactsmake tidy- Update go.mod dependenciesmake deps- Download dependenciesmake test- Run testsmake help- Show help information