VMware Cloud Community
ProSkub
Contributor
Contributor
Jump to solution

PowerCLI - Update existing alarm actions

Good day -

Looking to do a bulk update to our configured alarms, but I have had issues working with alarms in the past with powercli.

What I need to do is edit all alarms that have actiontype : send email and to have it repeat on all triggers - green to yellow, yellow to red, and then on the reset to repeat.

In the past, I have accidentally created new alarm actions/triggers thinking set-alarmdefinition would update the existing configuration.

Anyone have an idea to update the existing alarm definitions and their actions, without removing and creating new?

Thanks!

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You will have to work with the AlarmAction cmdlets.
Unfortunately, they only have a New and Remove format.

That would mean:
- read the current Sendmail Action (for the settings)
- remove the current Action

- create new Actions for all desired State changes

Let me know if you need a code sample?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

4 Replies
scott28tt
VMware Employee
VMware Employee
Jump to solution

Moderator: Moved to PowerCLI


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You will have to work with the AlarmAction cmdlets.
Unfortunately, they only have a New and Remove format.

That would mean:
- read the current Sendmail Action (for the settings)
- remove the current Action

- create new Actions for all desired State changes

Let me know if you need a code sample?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

ProSkub
Contributor
Contributor
Jump to solution

That is what I had thought. I was hoping the new update for powercli would expand on the recent work they have done for alarms, but it may be a bit.

Luckily, we have 15 sites that are monitored and only about 6 alerts that we have notify us as of now, so it is not too much.

Thank you for getting back, just was looking for confirmation and hopefully some insight into if someone else was able to update existing alarms actions.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Be aware that you might have to do additional checks, if for example an alarm has 2 or more triggers.
Also note that you can not remove all triggers on a specific action (SendEmail in your case).
An action must have at least one trigger.

I suspect the best bet is to remove the SendEmail action, including it's triggers, completely.
Then just create a new SendEmail action with the triggers you require.

That could avoid a needlessly complex script.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos