Home > Blogs > VMware PowerCLI Blog

Managing vSphere Alarms with PowerCLI

Greetings to all vSphere administrators out there! We are now going to take a look at a new functionality introduced in PowerCLI 4.1 Update 1 – namely vSphere alarms management. We assume that you are already familiar with the vSphere alarms functionality. For those of you who are not, here are some resources on the topic: vSphere Datacenter Administration Guide (see Chapter 13 “Working with Alarms”).

Here’s an excerpt from the VMware documentation – “Alarms are notifications that occur in response to selected events, conditions, and states that occur with objects in the inventory. … The vCenter Server system is configured with a set of predefined alarms that monitor clusters, hosts, datacenters, datastores, networks, and virtual machines.” The current PowerCLI 4.1 Update 1 release supports only modifying the predefined alarms that come with the installation of vCenter Server.

The new cmdlets are:

  • Get-AlarmDefinition
  • Set-AlarmDefinition
  • New-AlarmAction
  • Get-AlarmAction
  • Remove-AlarmAction
  • New-AlarmActionTrigger
  • Get-AlarmActionTrigger
  • Remove-AlarmActionTrigger

With the new cmdlets, you can modify: the alarm actions, the interval on which alarm actions repeat (if repeatable), the alarm names, the alarm descriptions, and whether the alarm is enabled or not. We’ll look at some examples of how we can use these alarm management cmdlets.

Get-AlarmDefinition is a typical PowerCLI getter. It returns all the alarms defined on the vCenter Servers you’re connected to. There are also some optional parameters which allow you to filter the results by name, by the inventory object on which the alarm is defined, and by its state (enabled or disabled).

Here are some examples:

Get-AlarmDefinition # This will return all the defined alarms on the servers you’re connected to

Get-AlarmDefinition -Name "virtual machine*" -Enabled $false # This will return all the disabled alarm definitions with names starting with “virtual machine”

Get-VMHost hostname | Get-AlarmDefinition # This will return all alarms that apply to the host “hostname”. This includes alarms defined on this host and alarms inherited from the parent entity, or from any ancestors in the inventory hierarchy.

Here’s how you can modify an alarm definition:

Get-AlarmDefinition "Host memory status" | Set-AlarmDefinition -Name "Host memory" -Enabled $false # This will rename the alarm to “Host memory” and disable it

The main part of the alarm definitions you can manage is an alarm’s actions configuration. You can create an alarm action this way:

Get-AlarmDefinition "Host storage status" | New-AlarmAction -Email -To “me@mycompany.com” -Subject "Host storage shortage" # This will create a send email action which will be triggered once when the alarm state changes from warning (yellow) to alert (red)

Here is how you can add another action trigger, which will fire earlier – when the alarm state changes from normal (green) to alert (yellow):

$action = Get-AlarmDefinition "Host storage status" | Get-AlarmAction -ActionType SendEmail # Get the action we previously created

$action | New-AlarmActionTrigger -StartStatus Green -EndStatus Yellow –Repeat # Add a new repeating trigger to the action

You can also set the interval at which the action is repeated:

Set-AlarmDefinition "Host storage status" -ActionRepeatMinutes (60 * 24) # This will configure the send email action to repeat once a day (as long as the alarm is in the yellow state)

Finally you may want to remove certain alarm actions. You can do it this way:

$action = Get-AlarmDefinition "Host storage status" | Get-AlarmAction -ActionType SendEmail

Remove-AlarmAction -AlarmAction $action

This is what you can do with the newly introduced cmdlets. The PowerCLI team has decided that the rest of the alarm functionality will not be reconfigured often enough to add cmdlets for the task. However you can always gain full control over the situation through the alarm’s View object. Here’s how you can change alarm configuration that is not available to change through the cmdlets:

# Get the alarm’s view

$alarmDefinition = Get-AlarmDefinition "Host storage status"

$alarmSpecification = $alarmDefinition. ExtensionData

# Make the desired alarm configuration changes

$alarmSpecification. Description="advanced-set description…..”

# Some other changes to the alarm configuration specification (for questions see the vSphere API Reference)

# Update the alarm

$alarmView = Get-View $alarmSpecification.Alarm

$alarmView.ReconfigureAlarm( $alarmSpecification )


Best regards,

-Angel Evrov, MTS at VMware




42 thoughts on “Managing vSphere Alarms with PowerCLI

  1. Carter Shanklin

    This is perfect for anyone who needs to build a whole lot of identical vCenter servers.
    Great work guys on another huge and useful update!

  2. Angel Evrov

    Speaking of identical vCenter servers – I’ve written a script that can export alarm definitions form on vCenter in a file and then import them on another vCenter, thus mirroring the alarms.
    Here’s the thread: http://communities.vmware.com/message/1618000#1618000

  3. JM

    Documentation for Set-AlarmAction* is missing from http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/index.html whereas there are links in http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Set-AlarmDefinition.html

  4. Angel Evrov

    Thanks JM, we’ll fix this.

  5. JM

    Uh, never mind.
    It seems this function doesn’t exist at all (yet).
    But if you include it someday, please also include New-AlarmDefinition etc. I’m having a hard time without this.
    In fact there should simply be Get, Set, New and Delete methods for every element (AlarmDefinition, AlarmAction, AlarmTrigger).
    Not sure why some have been implemented and others not.
    It depends on the people to judge which ones are useful to them. 🙂
    That would make copying/moving Alarms between vcenter server a hell of a lot easier.

  6. JM

    Please note that the export/import alarms issue is also adressed here: http://communities.vmware.com/thread/284908
    Especially http://communities.vmware.com/message/1667994#1667994 that I just implemented uses the new methods introduced here combined with some API magic to copy alarm items from one vcenter to the other.

  7. Colin Johnson

    I’m wondering if it is possible to add variables to the subject and body text for email alarm actions.
    I’d like to have some sort of format like
    Subject: $hostname cpu load is $cpu
    And something similar for the body text. Ideally I’d like to create shorter body text so that I can send the alarms as SMS.
    Can this be done?

  8. Jamie Skone

    I agree with Colin. We would really like to modify the subject of the alarm emails so they are more meaningful. Is this possible?

  9. Angel Evrov

    Hi Colin and Jamie,
    Yes, the content of to email can be customized to some extent. Although, the customization is rather limited.
    Here are the variables that can be used in the email action fields, that get populated at runtime (taken from the vSphere Api Reference):
    alarm -The object of the triggering alarm.
    alarmName – The name of the triggering alarm.
    declaringSummary – A summary of declarations made during the triggering of the alarm.
    eventDescription – The event description.
    newStatus – The status after the alarm is triggered.
    oldStatus – The status prior to the alarm being triggered.
    target – The object of the entity where the alarm is assocaited.
    targetName – The name of the entity where the alarm is triggered.
    triggeringSummary – A summary of information involved in triggering the alarm.
    Here is how you can create an alarm action that sends an email mentioning the name of the object that triggered it:
    > Get-AlarmDefinition EmailTestAlarm | New-AlarmAction -Email -Subject “VM {targetName} has powered on” -To me@mycompany.com

    1. Jeff T

      Have there been any updates to the list of email action fields? Are there any additional parameters or variables that can be used in the -subject and/or -body of the email?

      Jeff 🙂

  10. /

    Between all of the practice sessions, qualifying and racing, the vast
    majority of your time will be spent massaging the dual
    shock’s triggers. This game console unit can cost around $280 dollars and you can also
    receive special discount if you purchase bundle deals.
    Sony has made the Play – Station 3 into a multi-purpose
    entertainment system.

    Also visit my homepage: Playstation 3 Controller Battery
    Status (/)

  11. Stephen Wheet

    It looks like the Get-AlarmAction only the first alarm rather then getting them all. I’m trying to do the following

    Get-AlarmDefinition | Get-AlarmAction | Remove-AlarmAction -Confirm:$false

    In hopes that it would delete them all. It only deletes the first.

    I also tried the following thinking it was a syntax error or something:

    Get-AlarmDefinition | Get-AlarmAction | %{ $_ | Remove-AlarmAction -Confirm:$false}

    it gave me the same result. I’m running PS4.0 and PCLI 5.5.0-1295336. Looks like a bug in the cmdlet.


  12. Govind Gupta


    I am looking for a powercli command to set an alarm “Datastore disk usage alarm” for a specific set of datastores. Can anyone help me with the powercli command to setup this alarm for a specific datastore OR any command which can exclude some datastores from this alarm.


  13. choices stories you play free hacking

    Hi there, I wish for to subscribe for this website to get hottest updates, so where can i
    do it please help out.

  14. Pokerclub88

    CiputraQQ adalah agen pokerclub88 terpercaya di Indonesia. Menyediakan Permainan poker,dominoqq,ceme online terpercaya dengan ribuan pemain lainnya. Main dan raih jackpot 60 juta sekarang bersama kami dan Jadilah member setia kami sekarang juga !!!!!

  15. Dewapoker2019 asia

    Ayo Bergabung Bersama Dewa Poker mempunyai tim berpengalaman dalam melayani setiap member yang bergabung di situs poker online terbaik ini. merupakan salah satu Agen Poker Online paling baru, tapi untuk kualitas nya tidak perlu di ragukan lagi.

  16. Situs Togel Resmi

    Kami merupakan agen judi bandar togel online resmi

  17. Bandar Togel Online

    Bandar Togel Online Terbaik

  18. situs qq terbaik

    situs terbaik

  19. Ketuapoker

    Since centuries ago, gambling has existed and is very popular with most people of the world. many think gambling first appeared on the Americas and Europe, as evidenced by the many gambling games that come from there, namely baccarat, roulette & blackjack, and the number of casino stands in these continental countries, but in fact the forms of gambling appear parts of the world long before that. Mahjong, Keno and Paigouw, for example, come from China.
    At present, the world of gambling has transformed in line with the times and technology, where everything has become more sophisticated and online. You don’t have to fly to a neighboring country just to gamble. enough to use a computer or mobile phone you can already play gambling on the site / international online gambling agent. one of the best online gambling sites / agents in Indonesia is ketuapoker
    let’s join and feel the sensation

  20. qqplay88

    Web judi online terbaik

  21. poker88id

    Situs permainan Poker online terbaik di Indonesia

  22. qqjudibola

    Judi Bola Online TERBESAR

  23. karmaantv

    update cerita horror

  24. qqjudionline

    tips dan trik ampuh untuk anda di permainan judi online

  25. mafiaprediksi

    Angka Main HK, Angka Main Hongkong, Bocoran Angka Jitu, Bocoran Hk, Bocoran Hongkong, Bocoran Togel, Bocoran Togel Hk, Bocoran Togel Hongkong, Nomor Jitu HK, Nomor Jitu Hongkong, Prediksi Angka Jitu, Prediksi Hk, Angka Jitu Genting, Angka Main Genting, Bocoran Angka Jitu, Bocoran Genting, Bocoran Togel, Bocoran Togel Genting, Nomor Jitu Genting, Prediksi Genting, Prediksi Genting Jitu, Angka Jitu Sgp, Angka Jitu Singapura, Angka Main SGP, Angka Main Singapura, Bocoran Angka Jitu, Bocoran Jitu SGP, Bocoran Jitu Singapura, Bocoran Sgp, Bocoran Singapura, Bocoran Togel, Bocoran Togel Sgp, Bocoran Togel Singapura, Nomor Jitu SGP, Nomor Jitu Singapura, Prediksi Angka Jitu, Angka Jitu Sgp, Angka Jitu Singapura, Angka Main SGP, Angka Main Singapura, Bocoran Angka Jitu, Bocoran Jitu SGP, Bocoran Jitu Singapura, Bocoran Sgp, Bocoran Singapura, Bocoran Togel, Bocoran Togel Sgp, Bocoran Togel Singapura, Nomor Jitu SGP, Prediksi Angka Jitu, Prediksi Jitu Sgp, Angka Jitu Sydney, Angka Main Sidney, Bocoran Angka Jitu, Bocoran Jitu Sydney, Bocoran Sydney, Bocoran Togel, Bocoran Togel Sydney, Nomor Jitu Sydney, Prediksi Angka Jitu, Prediksi Sydney

  26. abu-abu

    berita hot, berita unik, seks sehat, info spa, info judi online, prediksi togel

  27. kucingbet

    Wow, a very interesting topic. And very inspiring. I hope you continue to share posts that help inspire people

  28. Capsa QQ

    Capsaviva ini merupakan salah satu Situs Judi qq Online Terpercaya dan Terbaik yang telah diakui oleh masyarakat diindonesia, khususnya para remaja maupun dewasanya. Maka dari itu jangan pernah ragu lagi untuk bergabung

  29. Togel Singapura

    Agen ini merupakan agen yang tepat bagi anda yang ingin bermain Togel dengan aman dan nyaman, agen kami akan memberikan anda pengalaman bermain terbaik. Selamat datang di dunia Judi Bersama Togel Singapura, Agen yang terpecaya dengan minimal deposit termurah. Situs Togel no 1 terbaik.

  30. pokerace

    Website judi online pokerace yang banyak di mainkan oleh pejudi profesional dan sebagai pilihan mereka,alasan nya karena terjamin kenyamanan dan keamanannya. Sistem server yang telah dienkripsi penuh menjamin 100% keamanan kumpulan data data para member dari pihak internal maupun eksternal. Sistem dengan spesifikasi terbaik dan tercanggih.teknologi terbaru nya juga telah kami siapkan untuk Anda semua para member agar dapat bermain dengan nyaman,tenang dan aman tanpa perlu khawatir adanya gangguan apapun.buruan segera kunjungi website nya dan segera mainkan permainan yang ada di dalam situs nya.

  31. Chuncunmaru

    Terdapat beberapa Game Terpopuler di Indonesia yang tersedia, seperti Texas Poker, Omaha Poker, Capsa Susun, Bandar Ceme, Ceme Keliling, Domino Qiu Qiu,. Semua permainan dapat dimainkan hanya dengan menggunakan 1 Akun ( 1 User ID untuk semua permainan ). Agen poker juga memberikan kemudahan player bermain di hanya dengan mendaftar deposit 20rb. Tentu semua orang ingin bermain di agen poker online terpercaya tanpa modal bukan? Walaupun bisa bermain tanpa deposit, anda tetap bisa menarik kredit yang tersedia didalam akun anda. Selamat bermain poker online uang asli dan dapatkan jutaan rupiah!!

  32. dewaLucintz

    Situs resmi poker online, tempat bermain menggunakan uang asli, untuk kenyamanan user kami selalu memperbaharui sistem baik itu perangkat keras maupun perangkat lunak untuk menjamin dan memastikan kenyamanan anda. Banyak fitur-fitur dan fasilitas yang kami sediakan salah satunya sistem special referral. Segera daftarkan diri anda untuk bergabung dalam permainan yang mudah dan menyenangkan di situs yang saya sediakan ini, merupakan salah satu perusahaan gaming online yang memberikan banyak jenis jenis permainan game kartu. Dengan jumlah pemain yang konstan dan banyak setiap harinya seperti ini, sudah sangat bisa di pastikan kalau banyak pemain judi online yang betah dan menyukai situs ini sebagai situs judi online pilihan. Tunggu apalagi, segera daftarkan diri dan dapatkan uang anda di agen judi poker online terpercaya. Bermain Judi Poker Online di situs ini jauh lebih menyenangkan karena anda bisa merasakan sensasi yang begitu fantastis ketika bermain di situs judi online yang resmi.

  33. 88Lucintz

    Update terbaru, rekomendasi situs poker online terpercaya di asia yang memberikan anda kesempatan menang lebih mudah! Tidak percaya? Buktikan dengan bergabung disini. Generasi poker online terbaru dengan banyak kelebihan memberikan anda kemudahan dalam mendaftar, deposit, withdraw, dan bermain. Dilayani dengan CS berpengalaman dengan predikat yang sangat baik. Memberikan nilai plus untuk kenyamanan anda dalam bergabung disini. Buktikan langsung dengan bergabung di situs poker online terbaik di tahun ini.

  34. pokerlounge

    Semua para pemain poker online mengatakan pokerlounge adalah permainan poker terbaik. karena banyak sekali bonus yang diberikan kepada member kami. kesempatan menangpun sangat banyak sekali. segara bermain dan bertemu rekan-rekan anda dalam dunia game poker yang lebih modern. hanya deposit minimal 5o ribu anda sudah bisa memainkan game yang sangat seru ini. ada beberapa game seru disini seperti poker capsa domino dan masih banyak lagi yang lainnya. jadi tunggu apalagi segera daftar di dan rasakan keseruan tantangan di situs game online kami. mungkin hoki anda sedang baik hari ini. selamat mencoba.

  35. chuncunmaru

    Jika kamu ingin main game poker judi online, tentunya kamu harus mengenal permainan poker itu terlebih dahulu. Jika kamu ingin lancar dalam memainkan taruhan poker, setidaknya ada langkah-langkah bermain poker yang harus kamu pelajari jangan asal main taruhan dan akhirnya kalah, Kamu harus membaca panduan aturan game dulu yang ada di game dewapoker tersebut jika kamu sudah benar benar paham dengan poker judi online, Maka kamu bisa memainkannya dengan teliti, Banyak testimoni dari beberapa orang setelah memainkan game judi poker ini dan mereka sangat tergiur akan hadiah uang yang diberikan admin poker kepada setiap member yang memenangkan tersebut.

  36. dominobet

    Bukan hanya kemudahan dalam mendaftar dan deposit di dominobet kami juga memberikan bonus dan tambahan deposit geratis. Cobalah untuk selalu mengatasi berbagai macam tantangan yang akan kalian hadapi untuk menjadi pemilik semua uang yang di pertaruhkan di meja judi ceme online terbaik. Demikianlah yang bisa kami buat semoga ini dapat membantu kalian dalam memenangkan pertaruhan di permainan judi.

  37. kucingbet

    Very good and interesting posts to share. I was very impressed. Hopefully you continue to provide posts that are very useful for many people

  38. raditbravano

    Dewapoker berdiri sebagai website poker online terbesar dengan uang asli di indonesia dan paling terkenal poker online terbesar di asia. DewaPoker Bandar permainan judi kartu terlengkap. http://www.capsaonlinedewapoker.com/ real money / uang asli di indonesia & di asia dengan deposit termurah.

  39. soupdavid125

    Dewapoker merupakan website poker online dengan uang asli di indonesia dan terkenal poker online terbesar di asia. DEWA POKER adalah game poker online dengan menggunakan deposit rendah dari Dewapoker. Mainkan game di link anda kan mendapatkan bonus setiap minggunya. Link alternatif Dewapoker Asia 2019.


    INIKARTU merupakan website poker online dengan uang asli di indonesia dan terkenal poker online terbesar di asia. DEWA POKER adalah game poker online dengan menggunakan deposit rendah dari Dewapoker. Mainkan game di link anda kan mendapatkan bonus setiap minggunya. Link alternatif Dewapoker Asia 2019.

  41. budianduk

    Capsaviva ini merupakan salah satu Situs Judi qq Online Terpercaya dan Terbaik yang telah diakui oleh masyarakat diindonesia, khususnya para remaja maupun dewasanya. Maka dari itu jangan pernah ragu lagi untuk bergabung


Leave a Reply

Your email address will not be published. Required fields are marked *