Since this was my first time using the vCloud API and SDK, I thought what better way to learn than to create a script similar to my vSphere Health Check Report for vCloud Director? This not only helped me to understand the objects in vCloud Director from an API perspective but no such reporting tool exists today for administrators and end users of vCloud Director.
Here is an example of what a report could look like: vCloudDirectorReport.html
To use the script, you will need the following per-requiste:
- Install vCloud SDK for PHP, take a look at article on how to get setup.
- Running vCloud Director 1.5 (Script uses the new API Query Service)
- Download both config.php which includes configuration parameters for the script and vmwarevCloudDirectorReport.php script.
lamw@ubuntudev:~$ php vmwarevCloudDirectorReport.php
Error: missing required parameters
Usage:
[Script]
VMware vCloud Director Report v1.0.0
[Description]
This script provides a detail report of your VMware vCloud Director system
[Usage]
# php vCloudReport.php -s
-s|--server
-u|--user
-p|--pswd
-t|--type
[Options]
-r|--report
[Examples]
# php query.php -s 127.0.0.1 -u admin@system -p password -t system
# php query.php -s 127.0.0.1 -u admin@coke -p password -t orgadmin
# php query.php -s 127.0.0.1 -u admin@pepsi -p password -t orguser
The config.php can be used to store the vCloud URL and credentials or you may specify it via the commandline using -s, -u and -p arguments. In addition, you will also need to specify -t flag which is based on the type of user you are logging into whether that is system (administrator), orgadmin or orguser.
The report can easily be customized by toggling parameters in config.php which includes the following parameters:
Depending on the report type, certain flags will be applicable. By default, all flags are enabled but you my disable ones you do not wish to see.
Here is an example of the script logging into vCloud Director instance with the administrator account in the System organization:
This is the first iteration of the script, I plan on adding additional information and if you have any feedback/suggestions, please leave a comment below.










Very useful post! Thanks for sharing!
ReplyDelete