TEST2222
Contributor
Contributor

Script Vcenter enable HA after reboot

Hello everybody,

I'm looking for a way to schedule a script that would check and enable (if disabled) HA after the boot of VCenter.
I know how to write a script with PowerCli but I do not understand how to schedule it and in which interface I could do it in VCenter.
If you have any idea, it would be great.

THanks

0 Kudos
4 Replies
scott28tt
VMware Employee
VMware Employee

@TEST2222 

Moderator: Moved to PowerCLI Discussions, the {code} areas are more for API/SDK issues.


-------------------------------------------------------------------------------------------------------------------------------------------------------------
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership

Afaik there is no event that is fired when a vCenter is started.
You can create an Alarm based on events that are fired when a HA setup is not working.
There are a few of those, no master HA to be found, vCenter disconnected from the HA master ...

The next issue is where to schedule an action based on such an Alarm.
It is definitely discouraged to run a script on your VCSA.

One option is to setup an SNMP manager.
An Alarm can send an SNMP trap to that server, and then this could trigger a script on that SNMP server.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
TEST2222
Contributor
Contributor

Thanks for your return.

Just for explain my need. I wish on power off cluster and set auto reboot DNS and Vcenter. For that actually with a Powercli script i shutdown all my VM, i disable HA and i set auto startup on my first host. After the auto reboot of the vcenter i would to auto enable the HA.

But do you have a another approach for auto reboot a cluster with its VM ?

0 Kudos
LucD
Leadership
Leadership

You could run that script on a dedicated station, reboot the vCenter, and then wait, in a loop, till the vCenter is back online.
When it is, the script can enable HA on the cluster.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference