Automation, Home Lab

Creating & Remediating Image Based Clusters with VMware PowerCLI

My time as a Systems Administrator came to an end 3 years ago, I had the self-realization that automation was not in my arsenal and the time needed to learn was not always there. HOWEVER..the relentless side of me still wants to learn a few new things.

While everything I did in the following blog could’ve been performed by a few single clicks within vSphere Client, performing the processes at scale or repetitive for any testing, automating makes much more sense.

The article assumes someone has some familiarity with PowerShell, PowerCLI, and VMware technologies.

To obtain the latest PowerCLI package, go to PowerShell Gallery – VMware.PowerCLI. Also, visit VMware Developer Documentation – PowerCLI

As always please take precautions and test these out always in a Test/Dev environment before executing in production environments. Also, this method is not the only way, there is always room for improvement.

This script should accomplish the following tasks:

  • Create a new cluster
  • Add 3 new 7.x ESXi Hosts
  • Place hosts in Maintenance Mode
  • Configure the cluster for Image-Based
  • Add VMware Tools 12.3.5 Component to the Image Cluster
  • Remediate the new cluster in Asynchronous

As a start, you may want to find out what targeted ESXi version you want to go to, any Components, or even Vendor Addons. You’re essentially querying everything available in the vLCM repository. My hosts are at 7.0u3g and after remediation should be at 7.0 U3o

The following will pull all BaseImages which are ESXi 7.x builds.

Get-LcmImage -Type BaseImage -Version '7*'

The only component we want to add/update is VMTools, the following will check for the latest version.

Get-LcmImage -Type Component *tools*

Please take the time to review the code below and replace variables and any sections with your enviornment. By no means it’s perfect but a good leap forward for me.

##The following script will create a new cluster and add 3 newly created hosts to the cluster##


##Creating a variable containing the hosts to be imported into vCenter##
$ESXiHost = Get-Content C:\scripts\<File containing hostnames>.txt

##Creates a new Cluster and adds 3 newly built hosts into vCenter##
New-Cluster -Name "<Cluster>" -Location (Get-Datacenter)
foreach ($ESXiHost in $ESXiHosts) {
Add-VMHost -Server <vCenter hostname> -Name $ESXiHost -Location "<Cluster>" -User root -Password "<password>" -Force }
Set-VMHost $ESXiHosts -State Maintenance -Confirm:$false -RunAsync | Out-Null

##The following section will go through creating variables containing the Base Image and any Components.##

##Creating a variable for base image version##
$esxiBaseImage = "7.0 U3o - 22348816"

##Creating a variable which points to the Base Image in the vLCM repository##
$esxiBaseImageName = Get-LcmImage -Type BaseImage -Version $esxiBaseImage

#For VMTools we are creating a variable containing to point to vLCM Component repository
$esxiCompToolsPackage = Get-LcmImage -Type Component -Version '*12.3.5'

#This command will begin to convert the selected cluster into an Image-Based cluster, remember **This is an Unreversable action** ##
Set-Cluster '<Cluster>' -BaseImage $esxiBaseImageName -Component $esxiCompToolsPackage -Confirm:$false

#This command will begin remediation of the cluster in asynchronous
Get-Cluster -Name '<Cluster>' | Set-Cluster -Remediate -RunAsync -AcceptEULA -Confirm:$false

The hosts in this sample were nested hosts created in the environment. Please don’t hesitate to reach out with any questions or comments.

Aria, Aria Operations, Uncategorized

Monitoring SQL DB Instance & Services using Aria Operations Telegraf Agents

In another blog I documented how to deploy a Cloud Proxy appliance so that you can monitor Services in an operating system. You can check that out here ‘VMware Aria Operations Cloud Proxy Deployment

For the following post I want to demonstrate monitoring a SQL Server services on a Windows Server virtual machine.

In our test today, I’m running Windows Server 2016 with SQL Server Express LIte as a VM.

From within Aria Operations, I will want to now deploy the Telegraf agent. **Please take a snapshot and take any precautionary backups**

Locate the object you want to deploy the Telegraf agent to, select and from the ‘Actions’ menu select ‘Install’

Select the Monitoring Availability and Cloud Proxy instance below, in my case, I have a single Cloud Proxy deployed. Click Done.

You have a couple of options to ensure authentication to the VMs is taking place. Selecting the top option ‘Common username & password” will allow me to define. Selecting ‘Enter virtual machine credentials‘ will allow you to download a template and populate it with username and passwords to upload back into the appliance.

I’m defining local Administrator permissions for lab and click Next.

Screenshot missing but on the final click ‘Install’ and installation should begin and you may monitor status in Aria Operations

Not too long, you should see a successful installation

With a few minutes, the agent should start reporting in new object data from the Windows Server instance and discover services. If you go to Configure>>Application Services

If you click on the ‘discovered’ in the Microsoft SQL Server service, it should take you to a list of monitoring features.

Now that we have discovered services, we can select what we want to configure and even add from ‘Custom Monitoring’. To ensure we are alarmed if a SQL service was to fail, we will select ‘Microsoft SQL Server’ and select Activate Service

We will select ‘Microsoft SQL Server’ click Confirm

The right-pane will bring up the following configuration menu, fill it out and click ‘Save’

In order to make this work I did have to enable port 1433 on my SQL instance to get the DB Instance to communicate with the collector, please work with your server and dba teams.

Monitor the configuration

Once configuration is successful you should now find the server in inventory deployed with an agent and reporting it in application data.

You can now bring up the object in Aria Operations and find additional data being pulled in from the DB Instance

You may also dive into associated Metrics for the SQL DB instance and start monitoring.

I hope this was found helpful and please ensure you follow best practices by taking snapshots, following associated documentation for your GuestOS and VMware.

Aria, Home Lab

VMware Aria Operations Cloud Proxy Deployment

In the following document I want to demonstrate the steps in deploying a Aria Operations Cloud Proxy. My reason for this deployment is to monitor services on Windows Server Guest VMs and even physical!

While there are many ways to get to Cloud Proxy deployment, all roads eventually lead to the section in Aria Ops. The following is one example.

Click on ‘Configure Cloud Proxy’ and it will take you under ‘Data Sources’ option to the left.

Click ‘Add”

Click the button indicated below to begin OVA download, this will be downloading from the Aria Operations appliance itself and should match the version of Aria Operations you are running in your datacenter.

I will jump over some steps of deploying the OVA template in vSphere assuming folks reading are familiar.

Be sure to review the following settings before you copy your registration key. The key changes if you choose to enable ‘Data Persistence’

Once the appliance has been stood, if successful, the collector should now appear in ‘Cloud Proxies’

You can also now see the 2 accounts which are included by default.

If we go back to review our Telegraft Agents, you can now see there are VMs being recognized which we can push agents out to.

Next article will be deploying the agent onto Windows Server VM or physical servers.

Home Lab

Upgrading VM Tools Package on Lifecycle Manager Clusters in vSphere 8

Starting with vSphere 7.0 U2, vSphere Lifecycle Manager introduced a feature where a cluster can be managed by a single, which helps create consistency across hosts in a cluster and simplify ESXi remediation.

VMware Tools we all knows is a critical component to have running on Guest VMs as its the software that allows the OS to interact with hardware and other solutions, essentially “drivers”.

VMware Tools versions do come shipped as a component of ESXi and also released outside of an ESXi Release.

The following steps demonstrate how to upgrade only the VMTools package on hosts without going to a newer version of ESXi. This is also running vCenter Server 8.0 U2

From the ‘Hosts & Clusters’ view in vSphere, navigate to the following section so that you can ‘Edit’ an Image

Under ‘Components’ Click ‘Show Details’ and it will display Components, toggle the Show to ‘All Components’

You can then filter by the name tool and the package should appear

If vCenter has connectivity to the internet, vSphere Lifecycle Manager should be going out and syncing updates from VMware-hosted repositories, you should then see newer versions of Tools to select.

Once selected, you may click ‘Validate’ and then click ‘Save’

Notice a component now appears and there is a message warning regarding the override as well as what version will be removed and what will now be included.

The Image Compliance will also report what is existing and what is on the image.

Next step would be to begin Remediation of your hosts in the cluster, VMware Tools package installations generally do not require any reboots for changes, however please always communicate with your teams and follow change control procedures.

Click ‘State Remediation’

The hosts completed succesfully and the Image is fully compliant. Sometimes VMs may not reflect a new version of Tools available on the hosts.

From the Cluster level, you can go to Updates >> VMware Tools and click ‘Check Status’

We now have a VM available and ready for update 🙂

Learn more by visiting VMware documentation and reading up on ‘Creating and Managing vSphere Lifecycle Manager Clusters

I hope you found this helpful and video to come soon running through this process.

Home Lab, QuickTip, vCenter Server

[Video] – VMware VMSA-2023-0023 – vCenter Server Patching 7.O U3o

For the everyday VI admin that is tasked or will be asked to ensure vCenter is patched when a VMware Security Advisory is released, I hope that you find the following video as a helpful guide to go through a vCenter patch process. Please coordinate with your in-house security teams, and proper maintenance windows, ensure snapshots are taken, try to achieve as much prep work as possible to make your change go smoother.

For multiple vCenters that are in Enhanced LinkedMode, ensure you take cold snapshots (VCSA Powered Off) of every vCenter. Also, in the event you have to revert back one of the vCenters, you must revert all of them at the same time.

Also, be aware if you are running any solutions that are provided by vendors that provide lifecycle automation that you coordinate with your support and account teams before going to the next version or patch.

VMware VMSA-2023-0023 Security Advisory – VMSA-2023-0023 (vmware.com)

vCenter 8.0 U2 – Download VMware vSphere – VMware Customer Connect

vCenter 7.0 U3o – Download VMware vSphere – VMware Customer Connect

vCenter 6.7 U3T – Download VMware vSphere – VMware Customer Connect

vCenter 6.5 U3v – Download VMware vSphere – VMware Customer Connect