In a previous post in this series (see PowerCLI & vSphere statistics – Part 2 – Come together), I showed the usefulness of the Group-Object cmdlet when working with statistical data. The script in that post grouped data samples for each hour together, which made it much easier to calculate the hourly average. With the Group-Object cmdlet you avoid numerous nested if- or switch-statements.
And best of all, you don’t have to code the grouping yourself, it was all done for you by the PowerShell Team.
So make sure this cmdlet belongs to your basic PowerShell repertoire. It will prove invaluable when processing statistical data.
This post will show you several of the different options you have to group statistical data together. And I will illustrate each of these with a sample script.
Continue reading PowerCLI & vSphere statistics – Part 4 – Grouping
An interesting question on Alarms arrived in my mailbox recently. Charlie wanted to know if it was possible to add an action to a selected set of the alarms he has defined in his vCenter.
The current PowerCLI build (version 4 update 1 – build 208462) unfortunately has no cmdlets to work with alarms. There are some alarm-related cmdlets available in the VI Toolkit for Windows Community Extensions. But none of these provides the functionality Charlie wanted to have.
Continue reading Alarms – Adding an action
In PowerCLI & vSphere statistics – Part 1 – The basics I briefly mentioned instances. In this post I’ll go a bit deeper into that subject.
And to demonstrate it all I will use part of the esxtop post on Yellow Bricks. In that post Duncan compiled, from various sources, a number of “common sense” thresholds that you can use in esxtop to show you possible problems with your hosts and/or guests.
Since I’m not sitting 24/7 behind an ESX/ESXi console, I looked for a way to let PowerCLI/PowerShell do that for me 😉
Continue reading PowerCLI & vSphere statistics – Part 3 – Instances
An interesting question came up in the PowerCLI Community recently. Jason wanted to use a script from another thread where you could connect a NIC to a specific portgroup while cloning a new guest from a template.
The script didn’t work when the requested portgroup was on a dvSwitch. Enough of a reason for me to have another look.
Continue reading dvSwitch scripting – Part 5 – Clone/pg to dvPG
The end of my previous post in this series, see PowerCLI & vSphere statistics – Part 1 – The basics, showed how you could get the statistical values for a specific day.
Depending on the point in time for which you request the values, the sampling interval will be different. For example Historical Interval 2 will return values measured over 30 minute intervals. See also the schematic I included in the previous post.
This sample interval is not always what you want for your reports. Suppose you want to always report hourly values and only for working hours during business days. This post will show you how to accomplish that.
Continue reading PowerCLI & vSphere statistics – Part 2 – Come together
Another popular subject in the VMTN PowerCLI community are statistics. Quite often it’s not entirely clear to the user what is available, how the data can be extracted and how PowerShell/PowerCLI can be used to convert the raw metrics into usable reports.
Before you can fully use all that is available, there are a few key concepts that you should understand.
In this series I will try to explain some common questions.
Continue reading PowerCLI & vSphere statistics – Part 1 – The basics
When I publish scripts that use SDK properties or methods, one of the questions that comes back regularly is “Where do you find what to use ?“.
Let me assure you, there are no tricks, optical illusions or black magic involved. I’m simply using the numerous resources that are made available in the VMware Developer community.
Diving into the SDK is like making a big trip, you have to start prepared !
Continue reading PowerCLI and the SDK – Part 2 – Prepare the trip
In a comment on my Events – Part 3 : Auditing VM device changes post, Ian asked if it was possible to report who started a VM.
To take away the suspense, yes that can be done by using the information from two of my earlier post.
Since I considered it a bit too long to give the solution in a comment, this post.
Continue reading Events – Part 4 : Who started that VM ?
In a comment on my Events, Dear Boy, Events – Part 2 post, Sham was wondering if it was possible to find out which device was actually changed on a guest.
Sham was able to find out who did a change, at what time and on which machine, but he also wanted to know what exactly was changed.
Since this is the kind of audit information that I would like to have as well I had a closer look. And luckily the VmReconfiguredEvent object had all the required information in the configSpec property.
Continue reading Events – Part 3 : Auditing VM device changes
When you try to migrate a guest, that is using one or more RDM disks, you might see this message.
The reason this is most probably because the LUN IDs are different on the source and the destination ESX server.
One solution is:
- stop the guest
- write down the Physical LUN ID
- remove the RDM disk(s)
- vMotion the guest
- add the RDM disk(s) to the guest based on the Physical LUN ID
- start the guest
But why do this the hard (manual) way when we have PowerCLI ?
Continue reading RDM & vMotion: inaccessible direct-access LUN