One of the typical question customers ask is: “How can we automatically add a new virtual machine in a Nutanix protection domain?”.
With VMware there are several options, like a vCAC post-customization trigger to vCO or AMPQ trigger for vCloud Director. But what if you just create a VM in vCenter?
The following solution is based on vCenter and the included vCenter Orchestrator (you can also use Powershell, python etc.). First of all there is no mechanism to “listen” for a new VM on vCenter, what´s bad. So you have to create an alarm that sends an SNMP trap like in my last post around witness automation.
This alarm could look like shown here:
Once we have our notification we can determine the VM and it´s name. With this information you are just one Nutanix API call away from protection! I created a protection domain called “tester” that has no VM´s protected and a 60 minute scheduler for local protection.
As a next step I added the REST operation for VM protection to the vCenter Orchestrator (I named it protectVm):
I added the vCenter as an SNMP device to listen for and cloned the “Wait for a trap on a SNMP device” workflow again (I named it NTNX_AutoProtectVm).
I created a new workflow called NTNX_protectVM and added it to the NTNX_autoProtectVm, that waits for the SNMP trap. Note: You can change inputs and attributes as you need them.
Finally I started the NTNX_AutoProtectVm and entered the protection domain name and created a VM called test1. The creation raised an alarm and vCO received the trap.
As last task I checked my protection domain and there´s a new VM protected!
Remember this as an simple solution description. In fact it´s just a trigger and an API call, what´s achievable with nearly every programming language or automation solution!