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

How to scrape metrics from not /metrics endpoint? #159

Open
witold-gren opened this issue Oct 21, 2023 · 2 comments
Open

How to scrape metrics from not /metrics endpoint? #159

witold-gren opened this issue Oct 21, 2023 · 2 comments

Comments

@witold-gren
Copy link

Hey,

I implemented prometheus-pve-exporter in my proxmox server. But my entire monitoring is run in external cloud configuration. To provide one endpoint to scrape all metrics from all services run in proxmox in decided to use PushProx. The all configuration works quite well.. but I realised that when I use this this tool then I can not scrape metrics from extra endpoint /pve but i must use only endpoint /metrics.

It is possible to configure more endpoints to scrape metrics?

- job_name: "proxmox"
  proxy_url: <<http://A.B.C.D:XXX>>
  metrics_path: /metrics
  ...
  static_configs:
    - targets: [proxmox.local:9221]

when I tried change metrics_path to use /pve then it not works.. any Idea how I can fix this issue?

@paul-dsh-ct
Copy link

Hey,

I had the same issue, I wanted to scrape gotenberg metrics which default endpoint is /prometheus/metrics. I managed to add a new flag in the pushprox client entrypoint by adding the following code in cmd/client/main.go:

In the variables declaration part:
endpoint = kingpin.Flag("endpoint", "Override metrics endpoint (default is /metrics)").String()

In the doScrape function:

if *endpoint != "" {
        request.URL.Path = *endpoint
    }

Then you just have to add the following flag to your client entrypoint: --endpoint=/another/metrics/path

Hope it can help you

@peekjef72
Copy link

Hey,

I had the same issue, I wanted to scrape gotenberg metrics which default endpoint is /prometheus/metrics. I managed to add a new flag in the pushprox client entrypoint by adding the following code in cmd/client/main.go:

In the variables declaration part: endpoint = kingpin.Flag("endpoint", "Override metrics endpoint (default is /metrics)").String()

In the doScrape function:

if *endpoint != "" {
        request.URL.Path = *endpoint
    }

Then you just have to add the following flag to your client entrypoint: --endpoint=/another/metrics/path

Hope it can help you

Hi,
Sorry, but like it was mentionned in #58, the path is not hardcoded: pushproxy is a proxy so it sends the exact query that is set by the client to the final target.

You can test it manually with curl shell cmd:

to reach node_exporter landing page on "client" host

curl -v --proxy http://pushproxy:8080 \
    -H "X-Prometheus-Scrape-Timeout-Seconds: 5" \
    http://client:9100/

to reach node_exporter status page

curl -v --proxy http://pushproxy:8080 \
    -H "X-Prometheus-Scrape-Timeout-Seconds: 5" \
    http://client:9100/status

to reach node_exporter metrics page

curl -v --proxy http://pushproxy:8080 \
    -H "X-Prometheus-Scrape-Timeout-Seconds: 5" \
    http://client:9100/metrics

So if you have trouble to reach the target, it is not the proxy but the config in prometheus !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants