Product Announcements

Configuring VDS Network Health Check Interval Using vSphere API

My colleague Venky Deshpande recently published an article about the new VDS Network Health Check feature which was introduced in the new vSphere 5.1 release. Venky provides an in-dept look on how this new feature works and I highly recommend you give it a read if you have not heard of this cool new feature. In his article, he also mentions that the VDS Health Check interval is configurable and I will show you how to do this using the vSphere API to automate the VDS Network Health Check configurations.

The default health check interval for both the VLAN/MTU and NIC Teaming setting is one minute. If you wish to change the default interval or specify a different interval for each setting, you can use the UpdateDVSHealthCheckConfig_Task method which applies to a Distributed Virtual Switch. You would also use this method if you want to enable or disable the health check feature. To demonstrate both of these configurations, I have written a simple vSphere SDK for Perl script called using this API.

Disclaimer: These script are provided for informational/educational purposes only. It should be thoroughly tested before attempting to use in a production environment.

The script supports two types of operation: query which allows you to check the current settings of a specific VDS and update which allows you to update the settings for either the VLAN/MTU and/or NIC Teaming setting. You will need to connect to a vCenter Server 5.1 to be able to use this script and specify the operation you wish to run and the name of the VDS using the –vds parameter.

To perform the query operation on a VDS called VDS-01, we would run the following:

./ –server vcenter51 –username root –operation query –vds VDS-01

Here is a screenshot running the query operation:

We can see from the screenshot above, the health check feature is currently disabled for both VLAN/MTU and NIC Teaming settings for our VDS. We can also see the default check interval is set to one minute. Let’s go ahead and enable the health check and change the default for VLAN/MTU setting to five minutes and NIC Teaming setting to ten minutes.

To enable or disable, there is the –vlanmtu and —teaming parameter which accepts a value of either true or false. To set the interval for VLAN/MTU, there is –vlanmtuinterval and to set the interval for NIC Teaming there is the –teaminginterval parameter.

To perform the update operation on a VDS called VDS-01 and enable the above mentioned, we would run the following:

./ –server vcenter51 –username root –operation update –vds VDS-01 –vlanmtu true –vlanmtuinterval 5 –teaming true –teaminginterval 10

Here is a screenshot of the update operation:

If you are interested in a PowerCLI solution, Raphael Schitz (famous for his one-liners) has also created a simple PowerCLI one-liner to modify the health check configurations and you can find more details on his blog here.

Get notification of new blog postings and more by following lamw on Twitter:  @lamw