Over the winter holiday I started to explore the vCloud API and one of our SDKs, vCloud SDK for PHP. VMware provides two additional vCloud SDKs: Java and .NET. I had used Java in college and I wanted to stay away from anything Windows related, so I thought I give PHP a try and it was the closest thing to Perl 😉

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.

To get a list of the available commandline options, just type "php vmwarevCloudDirectorReport.php":

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.

4 thoughts on “vCloud Director Report 1.0.0

  1. Thanks for this amazing work. My 2 cents.
    1. It’s pulling templates from public catalogs as well in vApp templates field. It should only pull templates beloging to catalogs of this Org.
    2. The tasks are pulled as – Last task first. Kindly reverse the order so that we can see the most recent tasks first in the list.
    Thanks and looking forward to more updates.

  2. @rajeshn123,

    1. I’m using the Query Service to extract all configs from vCD and it’ll list all things you have access to which will include public catalogs
    2. I’ve gone ahead and checked in the change

  3. To support SDK 5.5 and up you need to add the SDK version at login. Change line 131 to:

    $service->login($server, array(‘username’=>$user, ‘password’=>$pswd), $httpConfig, ‘5.5’);

    Or ‘5.6’ depending on your verison.

    Thanks for the script!

Thanks for the comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.