VMware Cloud Community
mulliganesx
Enthusiast
Enthusiast

Delete Inactive Alerts in Bulk

I have over 1000 inactive alerts and looking for an expedited way to clear these out.  Currently only able to do it 8 or so at a time by going to 'Alerts' tab selecting each of them, going to actions and deleting cancelled alerts. 

Looking for a better way, thanks!

0 Kudos
6 Replies
daphnissov
Immortal
Immortal

Use PowerShell to Get-OMAlert and then Set-OMAlert.

0 Kudos
RobertMesropyan
VMware Employee
VMware Employee

Starting from vROps 7.0 you can delete canceled alerts by single click from UI or by 

DELETE /api/alerts/bulk REST API

0 Kudos
mulliganesx
Enthusiast
Enthusiast

That sounds interesting, how do I access that REST API or utilize that? 

0 Kudos
dtaliafe
Hot Shot
Hot Shot

The REST documentation is on your vROps node at https://<vrops hostname>/suite-api

Here is a good intro video.

vRealize Operations Manager API Introduction w/ John Dias (@johnddias) - YouTube

0 Kudos
vjsingh10
Contributor
Contributor

Hi,

Can you expand on the commands?

i am able to run "Get-OMAlert -Status Active | Set-OMAlert -Cancel" which changes the alerts from "active" to "cancel" state.

How do I then delete canceled alerts?

from a quick google search i found Set-OMAlert only has few syntax and delete in not one of them

Set-OMAlert -TakeOwnership

Set-OMAlert -ReleaseOwnership

Set-OMAlert -SuspendMinutes

Set-OMAlert -Cancel

Thanks,

Vijay

0 Kudos
dtaliafe
Hot Shot
Hot Shot

You'll probably have to use the REST API to delete the cancelled alerts.  It's not built in to PowerCLI.  It's possible to access the API using "ExtensionData", explained here:

Using the entire API for vRealize Operations via PowerCLI - VMware PowerCLI Blog - VMware Blogs

However I searched and wasn't able to find the new delete API anywhere in PowerCLI. The vROps module hasn't been updated in a while so I suspect that might be why... or it's possible I missed it somewhere.

Either way I think it's worth noting that vROps will delete cancelled alerts automatically based on the global settings.  The default is after 30 days.  If you can work off of active alerts and think of the cancelled ones as just historical records they should clean themselves up after a while.

0 Kudos