Feature Idea: Disable Policies in New Alerts via API

Hi,

I have found that this question has been asked before, but I have discovered that the disabling of alert policies is not supported. So I have added my voice to a feature request, but I still need to find a solution for this before moving over to the new alerts system.

So looking here, I saw that:
“It is also possible to disable conditions in the new Alerts systems by changing the “enabled”: option to “false””.

So this is what I have been trying to do. I need to call the NR API from a cURL call that will be handed over to a trusted third party to bake into one of their scripts. So I thought something like this would work:

{
"condition": {
	"id": 506588,
	"type": "servers_metric",
	"name": "CPU % (High)",
	"enabled": false,
	"entities": [
		"11520164"
	]
    }
}

But this does not work… the response is asking me for a load of information that may change… surely with a condition id it should be possible to disable it without passing in the following:

{
	  "error": {
	    "title": "Metric can't be blank. Metric must be one of the following: `cpu_percentage`, `disk_io_percentage`, `memory_percentage`, `fullest_disk_percentage`, `load_average_one_minute`, `user_defined`. Terms can't be blank."
	  }
}

Otherwise the payload is quite large just to flick a disable/enable switch. So is there a simple way to disable/enable policies/conditions with the API?

Thanks in advance,

Stephen


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.

1 Like

Hi @stephen_barton,

Unfortunately the Alerts Conditions API endpoint does not accept empty or missing fields in the PUT request. However you can obtain the current configuration for the condition using a GET request, and then copy that output into your script, changing enabled to false. This doc goes through this process in detail: https://docs.newrelic.com/docs/alerts/rest-api-alerts/new-relic-alerts-rest-api/disable-enable-alerts-conditions-using-api

3 Likes

Hi,

This is disappointing. In an effort to automate the disabling of alert conditions (or better still policies) a manual copy/paste or a heavily scripted step is now required. I need to turn off maybe 10 alert policies for our server upgrades, which is about 70 alert conditions. That is a lot of additional GET requests and JSON parsing to do such a simple thing.
This is not progress and will probably mean that there will be a lot more noise (emails, Slack notifications etc) in our environment that were no there in the legacy alert system.

I know it is hard to please all of the people all of the time, but to be able to simply disable alerts via an API is not that unusual a requirement. I would be interested to hear how other people solve this.

Regards,
Stephen

1 Like

Hi @stephen_barton! I absolutely hear you: it’s a lot of steps, clicks, processes to do one thing. Sorry to hear your frustration and disappointment—you are right, it’s not at all an unusual request.

I will of course leave this thread open to the rest of the community in case there are any handy workarounds I am unaware of.

In the meantime, I have looped in out Alerts Product owner to your use specific case. :thumbsup: Also, I added a poll so that we can collect votes from other customers this may be affecting.

Thanks again for your candor! Please let me know if there is anything else I can do.

1 Like