Skip to main content

I am working on some command line automation and need to disable/enable an alert. I see that qoperation execscript is what I need but not seeing a qscript that will do what I want. Looking to disable an alert. Then the opposite to enable it.

Many thanks!

@RMcG - thoughts ? :)

 


I think the simplest method would be to use the REST API. If you want a quick way to do this via the Command Line then you can use the QCurl command https://documentation.commvault.com/11.24/expert/134805_executing_rest_apis_using_qcurl.html.

Basic steps...

  • Login using QLogin
  • List the alerts so you can fetch the alert id
    • qcurl -op GET -url "https://{server}/webconsole/api/AlertRule"
  • Disable the alert
    • qcurl -op POST -url "https://{server}/webconsole/api/AlertRule/{alertId}/Action/Disable" -req " "
  • Enable the alert
    • qcurl -op POST -url "https://{server}/webconsole/api/AlertRule/{alertId}/Action/Enable" -req " "

Alternatively if you’re a fan of PowerShell then you can use the Invoke-WebRequest or Invoke-RestAPI method to achieve the same.

Screenshot showing examples of QCurl method in action...

 Alert Operations REST API Docs:


Thank you so much! I’ve been using their qoperation cmds and wrapping them around Powershell. I’ve been avoiding the REST API a bit because I don’t fully understand how to implement it. Let me take a look some more. Thanks again!!


Reply