In this article Iāll try to explain how you can use the ESXi host state or vCenter Custom Attributes to automate the vRealize Operations object maintenance mode.
When working in a vSphere environment, you often have to patch or upgrade systems. If this environment is monitored by vRealize Operations, you want to avoid false positive alerts.
Putting a host in maintenance manually can be done from the Administration menu by choosing Inventory and browse through the object types looking for Hosts Systems. After selecting the correct host, you can put the host in maintenance mode.
Selecting objects in the Inventory explorer is not always very user friendly. If you donāt see any object because of multiple selections, āDeselect Allā is often the only way to get your full list back.
So, letās take a look at how to automate these tasks. In the first scenario we will use the maintenance state of a host in vCenter. This state can be used as a membership criterion in a custom group. This custom group can be configured with a maintenance policy thatās tight to a schedule.
The first step we need to take is create a schedule. In the following example, Iāve created a schedule with the name āAlwaysā. This schedule is configured with a date in the past and a date in the far future. This is much easier to configure in a policy compared to blocking all the alerts individually.
So now letās create a Maintenance Policy. In the āAnalysis Settingsā Iāve selected āAlwaysā as the Maintenance Schedule. This policy will be used by the Custom Group.
The Custom Groupās membership is based on the Property āRuntime|Maintenace Stateā with the value āinMaintenanceā. You also need to select the option āKeep group membership up to dateā.
Once the Schedule, the Policy and the Custom Group have been configured we can switch to vCenter and put two of the ESXi hosts in maintenance mode.
After putting the two hosts in Maintenance, we can go back to the vRealize Operations Inventory explorer and check the Collection State of both hosts.
We can see that sa-esxi-01 and sa-esxi-08 have entered the āIn Maintenanceā State. Thereās also a virtual machine in this list. Typically, thereās no option available in vCenter that allows you to put a virtual machine in maintenance mode.
In the next section we will look at putting other vCenter inventory items like datastores or switches in maintenance mode by using the vCenter Custom Attributes.
In this example we will look at how to put the app-01 virtual machine in maintenance. The first thing you need to do is create a Custom Attribute named Maintenance second, we have to assign āyesā as a value.
The next step is the creation of a new policy or edit the exiting Maintenance policy and include the āvCenter Adaptor - Virtual Machineā Object type.
Now we have to create a new Custom Group with a membership rule that checks the āSummary|Custom Tag:Maintenanceā property value. When this value is āyesā the virtual machine will automatically become a member.
In the Inventory we can see the Virtual Machine app-01 has stopped collecting metrics. The collection Sate is showing 3 grey icons. The attribute-based maintenance detection is not limited to virtual machines only, itās also possible with other vCenter inventory objects and also works on an ESXi host.