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:
1 |
Get-EventType | Where-Object {$_.Description -like "*reconfig*"} |
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:
1 2 3 4 5 6 |
$alarmTriggerInput = @{ EventType = $vmReconfigEvt EntityStatus = "Yellow" EntityType = "VirtualMachine" } $alarmTrigger = New-AlarmTrigger @alarmTriggerInput |
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$vmReconfigEvt = Get-EventType | Where-Object {$_.Description -eq "VM reconfigured"} $alarmTriggerInput = @{ EventType = $vmReconfigEvt EntityStatus = "Yellow" EntityType = "VirtualMachine" } $alarmTrigger = New-AlarmTrigger @alarmTriggerInput $alarmDefInput = @{ Name = "VM Reconfiguration" Description = "Alarm to monitor virtual machine reconfiguration events" AlarmTrigger = $alarmTrigger Entity = Get-Folder -Type Datacenter -NoRecursion } New-AlarmDefinition @alarmDefInput |
If we switch over to the vSphere Client, we can also see our newly created alarm there:
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:
Then, in the vSphere Client, we will also see the following:
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:
The code for Get-TriggeredAlarm
:
Summary
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!
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:
https://www.virtuallyghetto.com/2013/01/detecting-duplicate-ip-address-for-your.html
we need to create an alarm with a trigger of “esx.problem.net.vmknic.ip.duplicate” 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?
Did you figure out how to create a alarm where the trigger does not appear in Get-EventType?
It’s very informative article. Thank you for sharing with us.
A lot was learned after giving the information
Definitely trying this for my next vmware project!
Very Helpful. Thanks for sharing. Keep it Up : )
wow amazing and helpful information
wow this useful information
Its Very Fantastic Post..Thanku For Giving such Valuable Information
useful information great articles sir
Great, it’s very informative article. Thank you for sharing.
It’s very informative article. Thank you for sharing with us.
Hi Kyle Ruddy, Thanks for new vSphere Alarm Management. It’s Very useful for me, Thanks for the sharing.
Looking forward to using this new vSphere Alarm Management system.
Great it is important for me
the good website
Nice Information thanks for sharing. May you bring this more in future.
Its really awesome reading such a nice content. Thanks for sharing it.
This is a great article for vsphere alarm management system. You can also get much more from here,
Shop now in UK
more getting news
Amazing information. Thanks for sharing. Keep it up.
You are doing a great job. I have solved my problem to read this article. Thanks a lot.
Great amazing and helpful information. Thanks For Sharing.
hello kyle, you are really a good writer and thanks for share this great information
Literally, Amazing Content
Thanks 🙂
Great, it’s very informative article
. Thank you for sharing.
Amazing contant thank you . motivenews
Amazing contant thank you . motivenews
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.
hello kyle, you are really a good writer and thanks for share this great information
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.
Thank you very much for these great cake recipes, I have learned a lot from your web blog driving directions mapquest
Thanks for this useful information
yes you will get all kinds of amazing jobs knowledge from sarkarinaukari here so plz check
amazing jobs knowledge from jobs here so plz check
syllabusi
A rose tattoo can be used alone, as a filler, or in conjunction with other motifs. Angel wings on the sternum are a common underboob tattoo designs for women
Thanks for this information. make very testy cake for this information
wow very nice Rate Dekho
Really Nice Article Thanks for this useful information
Thanks For Sharing Amazin And Useful info.
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.
Really well written post
BPSC CDPO Question Paper 2022 PDF in English & Hindi
This is a fascinating subject, and I’d like to learn more about it, but I’m not sure where to start. Thankfully, you started this conversation, and I’m hopeful that everyone can help me.
good Job Sir, Thanks For Sharing.
What we learned about the vsphere alarm is useful in many ways in our company.
What I learned about the alarm is very useful in our company which I will share on my social media.
many thanks a good deal this amazing site can be conventional in addition to relaxed.
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.
Thank You! Sharing such a great article.
It is a niche post I love it.
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.
I am happy to reach on your website so thank you for your valuable information.
Thanks for sharing this. I really enjoyed reading it. It is very good. This is interesting as well as very engaging. I couldn’t stop until I finished it.
With this article my problem is solved
Nice article, Thanks for sharing this. I really enjoyed reading it. It is very good
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.
Great, it’s very informative article
. Thank you for sharing.
Great, it’s a very informative article
Thank you for sharing.
Wonderful post with amazing article. This post was very well written, and it also contains a lot of useful syllabus
Wonderful post with amazing article. This post was very well written, and it also contains a lot of useful
Thank you so much for sharing the sweet shout-out. I am very much excited to check out the sites you listed that I haven’t visited before. Syllabus
Knowing more information and much more is useful for the work of my business. also Learn about the importance of first aid boxes and how they are useful for your business
Very informative content
Very informative content . Thank for sharing this we love your all valuable content. I am always very excited to check your blog
I’m using vSphere Alarm Management for last 2 years and i have never face tech related problem with it.
Your content is very useful to users. I have read it many times.
The updated cdmlets are awesome.
Amazing and helpful information, Thank For Giving such Valuable Information, keep it Up
Thanks for such valuable information. I hope everyone will get benefited after reading this blog.
Very good information shared, thanks for this.
Thanks for provide us very good informative content. I am sharing the Blogging Tips related website.
Wow It’s really nice information shamshera Movie Really great Information thanks for sharing This Post
Good article shared, thanks for this.
Thank you for nice information. Please visit our website
Thank you for nice information. Please visit our website
morbi tiles compney list
rells hashtag
Kya Aap bhi Soch rahe ho ki loan kaise le Loan lene wala App Aapka loan turant hi Aapke Bank khate me bhej diya jayega
Kya Aap bhi Soch rahe ho ki loan kaise le Loan lene wala App Aapka loan turant hi Aapke Bank khate me bhej diya jayega
Thank you for nice information.
Kya Aapko bhi Ghar baithe WhatsApp use karke paisa kamana hai WhatsApp se paisa kamane ka Tarika Ghar baithe kamao
Thanks For Sharing Amazing And Useful information
Thank you for nice information. Please visit our informative website
i love making friends please unfriend me by clicking ok on my profile
hello friends i love to make friends make me friend by ok on my profile
I have read this article many times and found it very helpful to me. Thank you for sharing it.
Kya Aapko bhi Ghar baithe WhatsApp use karke paisa kamana hai WhatsApp se paisa kamane ka Tarika Ghar baithe kamao
Hello
Good information was shared, thanks for this.
Thanks for this wonderful post and hoping to post more of this!
you have explained very easily in this article Hindi Bandhan Visit Website
This article solved my problem, thank you very much Latest Movies Update
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
So here we are, providing exclusive news and updates in Hindi on our website. Do give a visit to us for NEET.
Thanks For Giving This Helpful Information
You have written very researched post. It will help us a lot. Keep sharing good information.
Your site was very informative and interesting as well. Thanks a lot and good luck.
That was a great article. Full with informative content on blog. Thanks for it.
This was a great article about VSphere Alarm Management. Thank you so much.
This post is great! but too many great hoodie I love chrissy stranger things s04 hoodie
dostinfo The article you have shared is informative
Very informative article Hindi Bandhan visit site
That was a great article.Thanks For Giving This Helpful Information. RAJASTHAN GOVT JOBS
What an amazing blog post you have written and I was in search of such kind of post for a long time, Thank You!
This post is great! but too many great hoodies I love government scheme in India.
Really this information is Great, Thanks for sharing such kind of information.
Hey, Thanks for this great post. Plz keep updating the post. You can visit our site paisawala where we have provide a info which is – make money with the help of smartphone . Thanks
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
Read More government jobs
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
Visit raj-results.com
fuhrerschein-kaufen
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
Very informative article Hindi Bandhan visit site
I read your blog and I can’t stop my self to read your full blog.
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.
Thank you for sharing this information; it was quite helpful to me.
Very good piece of information from your side on the matter.
Very good piece of information.
VMware you really doing great work I really grateful so have a blog like VMware
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
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
Best Short Moral Stories in Hindi
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
Very Good Information about vSphere Alarm Managament. Check out my blog TechStag
Thanks For Sharing This Information
Wonderful article. Fascinating to read. I love to read such an excellent article. Thanks! It has made my task more and extra easy. Keep rocking.
John Dutton White Jacket Season 5