Alarm expressions – Part 2 : Event alarms

In the previous part of this series (Alarm expressions – Part 1 : Metric alarms) I showed how you could create alarms that are triggered when a metric crosses a watermark.

zenIn this part I will show you how to create alarms when one or more specific events occur in your vSphere environment. More specifically I will show you how to create an alarm that will fire when someone adds or removes a license from your vCenter.

Continue reading Alarm expressions – Part 2 : Event alarms

Alarm expressions – Part 1 : Metric alarms

In a previous entry (Scripts for Yellow Bricks’ advise: Thin Provisioning alarm & eagerZeroedThick) I showed how you could use performance metrics to fire an alarm. The MetricAlarmExpression in that script requires a PerfMetricId to specify which performance metric the alarm should monitor. The counterId in that object is an integer and it is perhaps not too obvious which value corresponds with which metric.

metric-alarm

This blog entry shows how you can quickly get a list of permitted counterIds (and instances) for a specific entity. And it will show how to create some “impossible” alarms !

Continue reading Alarm expressions – Part 1 : Metric alarms

PowerCLI and the SDK – Part 1

In the Developer forum there was an interesting post called Resources for folks new to the vSphere Web Services SDK. Now unfortunately the Hello World guide was (again) only aimed at Java programmers.

Although PowerCLI is nearing perfection, you sometimes will have to go to the SDK methods and properties to make your script go that extra mile. Since I know, from first-hand experience, that the first steps in the SDK are not that simple for PowerShell programmers/scripters I decided to start a series to make the SDK more accessible for the PS people.
Continue reading PowerCLI and the SDK – Part 1

Events, Dear Boy, Events – Part 2

In a previous entry (see Events: a great source of information – Part 1) I showed how to use the VmCreatedEvent event to find out which guests were created longer than 30 days ago.

In the vSphere SDK documentation there are currently 432 events listed. That makes it sometimes hard to decide which event(s) to use for your reporting/auditing needs.

But luckily there are some tricks to make it easier on you.

Continue reading Events, Dear Boy, Events – Part 2

Onyx – Why Learn PowerCLI ?

The PowerCLI Team yesterday published with the Onyx Project a great tool with lots of potential. The blogging community received Carter’s announcement enthousiastically (see for example The Onyx has landed).

As a casual PowerCLI user you might think, the product has a strange name but it is the answer to all my scripting and automation needs. Why should I bother learning all these PowerCLI cmdlets while this tools produces working code. But think again !

Continue reading Onyx – Why Learn PowerCLI ?

Scripts for Yellow Bricks’ advise: Thin Provisioning alarm & eagerZeroedThick

On the Yellow Bricks blog there was today a very interesting entry called Performance : Thin Provisioning. Besides the link to the excellent VMware document called Performance Study of VMware vStorage Thin Provisioning, Duncan also included some tips and tricks.

Since I’m in favour of automating as much as possible in my vSphere environment, I decided to have a look how all this could be scripted.

Continue reading Scripts for Yellow Bricks’ advise: Thin Provisioning alarm & eagerZeroedThick

My PS snapins & modules

In the My PS … series of blog entries this entry lists the SnapIns and Modules I use (regularly).

Note that the following list is my personal list and that it is definitely not my aim to list all available PowerShell snapins and modules. That would be a sheer impossible task, seen the abundance of the currently available  snapins and modules.

module

Previous entries in this series were My PS toolbelt and My PS library. Continue reading My PS snapins & modules

CreateAlarm not (always) compatible with the vSphere client

In a recent PowerCLI Community thread someone asked how he could create Alarms with the current PowerCLI build. Since there is no PowerCLI cmdlet (yet) to create Alarms I had to fall back on the CreateAlarm method from the SDK.

The procedure as described in the vSphere Web Services SDK Programming Guide, chapter 15, is quite simple. The script I wrote created the alarm, but to my amazement I couldn’t use the Edit Settings option in the vSphere client. The option was grayed out.

alarm-edit-settingsFirst I doubted the correctness of my script but after some tests I could confirm that the alarm worked correctly. Continue reading CreateAlarm not (always) compatible with the vSphere client

Assign a vCenter license

An interesting question arrived in my mailbox recently. The user was trying to find out how he could assign a vCenter license. The vSphere API Reference clearly pointed to the UpdateAssignedLicense method.

But the value that should be provided in the entity parameter was a bit of a mystery.  An entity ID for a vCenter was new for me.

UpdateAssignedLicense-parameters

Continue reading Assign a vCenter license

dvSwitch scripting – Function index

Over the last few weeks I have published a number of blog entries that showed how you could use PowerShell, PowerCLI and the SDK to automate the management of the vNetwork Distributed Switch.

To facilitate the use of the functions I provided in these posts I created a table that lists all the dvSwitch related functions together with a link to the post where they were published.

Functionname Description Link
New-dvSwitch Creates a new dvSwitch Part 1
Get-dvSwHostCandidate Find hosts that can be connected to a dvSwitch Part 1
Add-dvSwHost Add a host to a dvSwitch Part 1
Get-dvSwitch Find a dvSwitch by name Part 2
New-dvSwPortgroup Create a new dvPortgroup Part 2
Get-VLANRanges Internal function ! Do not use directlu. Part 2
Set-VM2dvPortgroup Connect a VirtualMachine to a dvPortgroup Part 2
New-InternaldvSwvNic Internal function ! Do not use directly. Part 3
New-dvSwConsole Create a Service Console on a dvSwitch Part 3
New-dvSwvmKernel Create a vmKernel on a dvSwitch Part 3
Set-dvSwPgvMotion Enable vMotion on a vmKernel dvPortgroup Part 3
Set-dvSwPgFTLogging Enable FT logging on a vmKernel dvPortgroup Part 3
Set-dvSwUplink Update the number of uplinks on a dvSwitch Part 4
Add-dvSwHostpNic Add pNics to a dvSwitch Part 4
Set-dVSwPgTeam Set up Nic Teaming on a portgroup on a dvSwitch Part 4
<script> Clone a guest and connect to a dvPG Part 5
New-dvSwPVLAN Create PVLAN Part 6
Set-dVSwPgPVLAN Assign a PVLAN to a portgroup Part 6
Get-dvSwPg Find a portgroup Part 7
Set-dvSwPgVLAN Change the VLAN Id of a portgroup Part 7
Get-dvSwNetworkAdapter Get network adapter information Part 8
Set-dvSwNetworkAdapter Change portgroup connection of a network adapter Part 8
Get-dvPgTrafficShaping Get the traffic shaping settings of a portgroup Part 9
Set-dvPgTrafficShaping Set the traffic shaping settings of a portgroup Part 9
New-dvSwNetworkResourcePool Create a user-defined network resource pool Part 10
Remove-dvSwNetworkResourcePool Remove a user-defined network resource pool Part 10
Get-dvSwNetworkResourcePool Retrieve user-defined network resourcepool(s) Part 10
Set-dvSwSIOC Enable/disable NetIOC on a dvSw Part 10
Get-dvSwSIOC Retrieve the NetIOC status Part 10
Get-dvVmPort Get port used by VM NIC Part 11