opensearch-project / alerting

📟 Get notified when your data meets certain conditions by setting up monitors, alerts, and notifications
https://opensearch.org/docs/latest/monitoring-plugins/alerting/index/
Apache License 2.0
59 stars 102 forks source link

[FEATURE] Get all monitors via API #430

Open faabsen opened 2 years ago

faabsen commented 2 years ago

Is your feature request related to a problem? Currently, there is no API call to get all monitors (like for destinations. It is only possible, to use the monitor search API, however, finding all monitors is a bit tricky (thanks to simo222 @ OpenSearch#1808).

Within Elasticsearch, it is easily possible to get all watchers via API and to update them (due to its unique name).

What solution would you like? Get an endpoint for all endpoints (similar to the one for destinations). Moreover, adapt the structure to the one used by destinations.

What alternatives have you considered? Trying to use the described "workaround". However, updating a monitor is kind of a pain, especially when using infrastructure as a code.

lezzago commented 2 years ago

The searchMonitor supports getting all monitor with just this simple call:

GET _plugins/_alerting/monitors/_search
{
  "query": {
    "match_all": {}
  }
}

I understand that the API structure is not the same as the GetDestinations API, but we dont want to change to structure of that API as we do not want to introduce backwards compatibility breaking changes.

For now, I will put this on our backlog for when we revisit our APIs and want to change their structures.