What’s New for vSphere Alarm Management

One of the hot topics at VMworld EU was around alarm management and the new cmdlets which were recently made available. There has been a solid set of alarm-based cmdlets that already exist and have been part of PowerCLI for many years. However, as evidenced by a PowerCLI session at VMworld in 2017 where we dug into some examples only available by the API, those cmdlets didn’t give quite give us everything we needed. Therefore, PowerCLI 11.5 added 6 new cmdlets and 3 updated cmdlets to help manage alarm definitions, create alarm triggers, and pull information about available event types and metrics.

These new cmdlets are as follows:

  • New-AlarmDefinition
  • Remove-AlarmDefinition
  • New-AlarmTrigger
  • Get-AlarmTrigger
  • Get-EventType
  • Get-Metric

The updated cmdlets are as follows:

  • New-AlarmAction
  • New-AlarmActionTrigger
  • Set-AlarmDefinition

Let’s run through creating a new alarm with these cmdlets.

VM Reconfiguration Alarm Creation

There’s been a migration over the years to treat VM workloads in a more disposable fashion. This means that instead of making changes or updates directly to the deployed VM, we would destroy and re-deploy a new VM with the new configuration. Therefore, we’re looking to create an alarm when any VM has been reconfigured.

To create this alarm, we will need to make use of a couple of the new cmdlets that were introduced with PowerCLI 11.5. Namely: Get-EventType, New-AlarmTrigger, and New-AlarmDefintion

First, we need to find the particular event type related to a VM reconfiguration event. There are over 400 different event types, so we’ll want to get a little more specific by using a filter.

Filter Example:

Example: Viewing a filtered list of Event types

Looking through the response, we can see the last event type is the one we happen to be looking to use.

Next, we need to create an alarm trigger which will be based off of the event type we found in the prior step. For this we will use New-AlarmTrigger. This new cmdlet will have two other parameters we will need to populate as well, EntityStatus and EntityType. The EntityStatus parameter controls what the alarm severity will be. The available statuses are listed here: EntityStatus values Example: an EntityStatus of “yellow” is a warning. The EntityType parameter controls what object types the alarm can be referenced against. Example: VirtualMachine, HostSystem

For our use case, we’re going to use the following code to create a warning when a VM reconfigure task has been performed:

Lastly, we will be defining our alarm with the New-AlarmDefinition cmdlet. There are a few parameters which we’ll use to define this new alarm, including: Name, Description, AlarmTrigger, and Entity. The first two are describing our new alarm. The AlarmTrigger parameter is referencing the trigger we built in the prior step. The Entity parameter is not quite as straightforward. This parameter is actually describing at what level the alarm should be applied. Example: to apply this alarm to only a specific cluster, the entity would be for that cluster object. For this use case, we want the alarm to apply across the entire vSphere environment so we will apply it to the top-level folder named “Datacenters”.

The code to create this new alarm will look like the following:

Example: Creating a new alarm based on VM reconfiguration events

If we switch over to the vSphere Client, we can also see our newly created alarm there:

Example: Newly created alarm as viewed in the vSphere Client

That’s it! Our new alarm is created and enabled by default for usage in our environment.

Listing Active Alarms

The next question is normally “how do we list the alarms with PowerCLI?” Unfortunately, there is not a function to list these alarms easily. However, almost every top-level, managed object (technically, ManagedEntity) has a property available at the vSphere API level that we can reference to easily discover any active alarms. This property is known as the TriggeredAlarmState. When it comes to PowerCLI, this property is available through an object’s ExtensionData.

Going back to our vSphere environment, we can modify a VM in PowerCLI and see that our newly created alarm does work as planned by referencing that TriggeredAlarmState property:
Example: Modifying a VM and viewing the TriggeredAlarmState property

Then, in the vSphere Client, we will also see the following:
Example: Alarm as viewed in the vSphere Client

The output from the TriggeredAlarmState property feels like it’s being pulled directly from the vSphere API and doesn’t easily give us some important information which we can easily turn into a report. I created a new advanced function and shared it on the VMware Code Sample Exchange and on the PowerCLI Community repo, it’s called Get-TriggeredAlarm.

Get-TriggeredAlarm in action:
Example: Get-TriggeredAlarm usage

The code for Get-TriggeredAlarm:


The latest version of PowerCLI 11.5 gave us a number of updates, including a handful of new and updated cmdlets which allows us to streamline the process of automating vSphere alarm management. These 6 new cmdlets and 3 updated cmdlets help manage alarm definitions, create alarm triggers, and pull information about available event types and metrics. This blog took a look at how to easily create a new alarm, including identifying a particular event and creating an alarm trigger, as well as how to report back alarms that are already active for particular vSphere objects.

Install PowerCLI 11.5 today and let us know in the comments what you’d like to see added next when it comes to vSphere alarm management!


125 comments have been added so far

  1. This is looking great, but the first Alarm that I wanted to script the creation of has a trigger that does not appear in Get-EventType

    Following the article here:

    we need to create an alarm with a trigger of “” which we can copy and paste into the HTML5 interface as a trigger and after saving the alarm it changes to become “A duplicate IP address was detected on a vmknic interface”
    Using Get-EventType to search for this as the description does not return any results, but if I Get-AlarmTrigger from a manually created trigger, it has the proper EventType data.

    Get-EventType does have “Duplicate IP detected”, but this does not trigger for a duplicate IP on vmknic across hosts as we had encountered.

    Is there any way to manually create the proper EventType object to feed into New-AlarmTrigger so we can script this across multiple vCenter?

  2. You explain everything very well. I have read many of your articles as well. If I want any information related to this, then I come directly to your website by searching Google.

  3. The Friday Night Funkin challenges your rhythm. The game will ask you to press a key at a specific time: the screen will show which key to press and the game will score for both a specific time and a shorter time.

  4. Thanks, sir for such great information it has helped me a lot, I will share it with my friends
    please visit for skin care-related articles and many more interesting things.

  5. Thank You! Sharing such a great article, It’s been an amazing article. It provides a lot of information, I enjoyed reading this, I hope, I will get this kind of information regularly from your side.

  6. waytosuccessPoints you raised very valid points in your post. It really happened some people do not have the right idea. But with your awesome tips, one can easily identify it. This post is discussing in an outstanding way.

  7. Friday Night Funkin is one of the most perfect games I have ever known, the combination of music and vivid images always makes us love it. Enjoy the relaxing moment it brings today.

  8. Friends, my purpose will be to take this education website, we cover the syllabus of all government exams in India in full detail syllabus for alland are preparing for government jobs. We help all the upsc students in the best possible way so that they do not have any questions about theRajasthan-All-Govt-Jobs

  9. Rajasthan Govt Jobs 2022 Rajasthan Government has issued Latest Rajasthan Government Job Notifications to fill vacant posts in many departments. The Government of Rajasthan extends its services and development every year by recruiting employees. You can get the complete updates of Rajasthan Sarkari Naukri 2022 first through Rajasthan Employment News

  10. All the information you need related to government jobs will be found from here, you can see from here as such. Government Recruitment, Uttar Pradesh Government Jobs, Uttarakhand Government Jobs

  11. Your article is very good and receives the attention of many readers around the world. This is a great knowledge sharing website that we should know and share it with our friends and relatives.

  12. very nice info tqs for this you can read also
    Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends

  13. very nice info tqs for this you can read also
    Thanks for sharing this quality information with us. I really enjoyed reading. Will surely going to share this URL with my friends

Leave a Reply

Your email address will not be published.