Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] prometheus datasource: Request failed to get to the server (status code: 502) #2551

Open
rmarops opened this issue Sep 21, 2023 · 6 comments
Labels
bug Something isn't working Security

Comments

@rmarops
Copy link

rmarops commented Sep 21, 2023

Describe the bug
when adding prometheus as a datasource from dev tools, I get Request failed to get to the server (status code: 502)

To Reproduce
Steps to reproduce the behavior:

POST _plugins/_query/_datasources
{
    "name" : "prometheus",
    "connector": "prometheus",
    "properties" : {
        "prometheus.uri" : "http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com:9050"
    }
}

Returns:
Request failed to get to the server (status code: 502)

  • i confirm that 9050 is a nonstandard port I am using while testing a fresh docker run of prometheus
  • from the opensearch host cli, a curl http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com:9050/metrics returns results

Expected behavior
no error and a working datasource

Plugins
opensearch-alerting 2.9.0.0
opensearch-anomaly-detection 2.9.0.0
opensearch-asynchronous-search 2.9.0.0
opensearch-cross-cluster-replication 2.9.0.0
opensearch-geospatial 2.9.0.0
opensearch-index-management 2.9.0.0
opensearch-job-scheduler 2.9.0.0
opensearch-knn 2.9.0.0
opensearch-ml 2.9.0.0
opensearch-neural-search 2.9.0.0
opensearch-notifications 2.9.0.0
opensearch-notifications-core 2.9.0.0
opensearch-observability 2.9.0.0
opensearch-performance-analyzer 2.9.0.0
opensearch-reports-scheduler 2.9.0.0
opensearch-security 2.9.0.0
opensearch-security-analytics 2.9.0.0
opensearch-sql 2.9.0.0

Host/Environment (please complete the following information):

  • OS:
    Amazon Linux
  • Version
    2023

Additional context
following https://opensearch.org/docs/latest/observing-your-data/prometheusmetrics/

@rmarops rmarops added bug Something isn't working untriaged labels Sep 21, 2023
@rmarops
Copy link
Author

rmarops commented Sep 21, 2023

Reproduced by extracting and running prometheus locally on the opensearch host, confirmed curl localhost:9090/metrics produced metrics then attempted from devtools:

POST _plugins/_query/_datasources
{
    "name" : "prometheus",
    "connector": "prometheus",
    "properties" : {
        "prometheus.uri" : "http://localhost:9090"
    }
}

image

@yudhiesh
Copy link

Facing the same issue adding an ML connector using POST /_plugins/_ml/connectors/_create, did you find a fix? I am using OpenSearch 2.9.

@scubbx
Copy link

scubbx commented Oct 23, 2023

I can confirm having the same problem.
But a subsequent GET request shows that the connection was stored in OpenSearch at least.
Not sure if related, but the "allowedRoles": [] field in the GET reqest is always empty, despite having set up the roles according to the documentation (https://github.com/opensearch-project/sql/blob/main/docs/user/ppl/admin/security.rst).

@andrross
Copy link
Member

@bbarani Can you transfer this issue to https://github.com/opensearch-project/sql? I believe the POST _plugins/_query/_datasources API in question here is implemented by the SQL plugin.

@bbarani bbarani transferred this issue from opensearch-project/OpenSearch Mar 12, 2024
@penghuo penghuo removed the untriaged label Mar 27, 2024
@penghuo
Copy link
Collaborator

penghuo commented Mar 27, 2024

@vamsi-amazon could u take a look of this issue.

@AdaptiveStep
Copy link

AdaptiveStep commented May 1, 2024

i have this problem too. Same situation: It gives 502 error, but if you try to post it again, it says it already exists. But when you look in the observability/metrics tab, it cannot be found there.

Does the prometheus connector work for anyone at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Security
Projects
None yet
Development

No branches or pull requests

7 participants