integrations-core icon indicating copy to clipboard operation
integrations-core copied to clipboard

Elastic: snapshots (slm_stats) not working with OpenSearch

Open plumdog opened this issue 2 years ago • 3 comments

When targeting OpenSearch and setting slm_stats: true, get an error like:

401 Client Error: Unauthorized for url: https://[myopensearch].es.amazonaws.com:443/_slm/policy"
Traceback (most recent call last):
  File "/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/base/checks/base.py", line 1224, in run
    self.check(instance)
  File "/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/elastic/elastic.py", line 175, in check
    policy_data = self._get_data(slm_url)
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/datadog-agent/embedded/lib/python3.11/site-packages/datadog_checks/elastic/elastic.py", line 338, in _get_data
    resp.raise_for_status()
  File "/opt/datadog-agent/embedded/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://[myopensearch].es.amazonaws.com:443/_slm/policy

It looks like OpenSearch doesn't have the the _slm/policy API https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html but rather a _plugins/sm/policies API https://opensearch.org/docs/latest/tuning-your-cluster/availability-and-recovery/snapshots/sm-api/. It looks to me like these are logically similar, but OpenSearch doesn't provide the same stats values as Elasticsearch to provide the slm metrics.

However, there is the _snapshot/ API that both support (see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-snapshot-api.html and https://opensearch.org/docs/latest/api-reference/snapshots/get-snapshot/) that could be used to provide useful metrics, eg the number of snapshots for each index, the oldest and most recent snapshots for each index.

plumdog avatar Jun 26 '24 15:06 plumdog

Hi @plumdog 👋

We're cleaning up our backlog as part of improving our issue management process. Can you confirm whether this issue is still valid? This will help us prioritize our efforts. Thanks!

jacjtito avatar Jun 23 '26 13:06 jacjtito

This issue has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this issue is still relevant, adding a comment will keep it open. Also, you can always reopen the issue if you missed the window.

Thank you for your contributions!

dd-octo-sts avatar Oct 25 '26 22:10 dd-octo-sts

This issue was automatically closed because it has been stale for 30 days with no activity.

If this issue is still relevant, please reopen it or create a new issue with updated information.

Thanks!

dd-octo-sts avatar Nov 26 '26 16:11 dd-octo-sts