VMware Communities > VMTN > VMware vSphereâ„¢ > Availability: HA & FT > Discussions

This Question is Answered

6 Replies Last post: Jul 3, 2009 1:57 PM by lamw
Reply

Fault Tolerance: automatic schedule / scripting

Jun 20, 2009 2:20 PM

Click to view blondie72's profile Novice blondie72 5 posts since
Jun 20, 2009

Hi NG,

we would like to enable/disable FT on a VM by scheduled task or scripting on CLI (cronjob).

Is this possible at all, if so how?

Regards

Reply Re: Fault Tolerance: automatic schedule / scripting Jun 20, 2009 9:27 PM
Click to view AndreTheGiant's profile Guru AndreTheGiant 5,621 posts since
Aug 28, 2008
Actually you cannot use "scheduled task" feature in vCenter Server.
I think that the only way is use PowerShell or other script language.

Andre
Reply Re: Fault Tolerance: automatic schedule / scripting Jun 21, 2009 4:54 PM
Click to view lamw's profile Champion lamw 2,748 posts since
Nov 27, 2007
There are no default CLI utilities that support this right off the bat but you can take a look at using vSphere SDK for Perl or PowerCLI to accomplish this task.

Take a look at EnableSecondaryVM_Task() to enable FT and DisableSecondaryVM_Task() to disable FT. If you provide the credentials either through a config file or hardcode it within the script, then you can setup a Windows scheduled task to enable/disable FT, but you won't be able to schedule this within vCenter itself. You can also set the script run via a cronjob if you're using a UNIX/Linux or even vMA to execute the script.

If I get some free cycles this week, perhaps I'll write up a quick Perl script to show how this is done, but the methods are pretty straight forward and so long as you have the appropriate license for FT.


=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Reply Re: Fault Tolerance: automatic schedule / scripting Jul 3, 2009 8:50 AM
in response to: lamw
Click to view Texiwill's profile Guru Texiwill 10,056 posts since
Jan 13, 2004
Moderator
Reply Re: Fault Tolerance: automatic schedule / scripting Jul 3, 2009 9:15 AM
Click to view lamw's profile Champion lamw 2,748 posts since
Nov 27, 2007
Take a look at this script: http://www.yellow-bricks.com/2009/07/01/ftcli-pl-vmware-fault-tolerant-managment/

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Reply Re: Fault Tolerance: automatic schedule / scripting Jul 3, 2009 1:57 PM
in response to: lamw
Click to view blondie72's profile Novice blondie72 5 posts since
Jun 20, 2009

Hello NG,

thanks for your support.

That's what I have been looking for.

Great script, thanks a lot.

CU

Reply Re: Fault Tolerance: automatic schedule / scripting Jul 3, 2009 1:57 PM
in response to: blondie72
Click to view lamw's profile Champion lamw 2,748 posts since
Nov 27, 2007
np. Let me know how testing goes.

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Actions