2
votes

Can some one help me what configuration I need to add in prometheus.yml to scrape on a URL like https://www2.abc.abc.com/servlet/metrics/?

I was able to get the regular node exporter scraped but we are building something with custom metrics.

My current config file looks like this:

global:
  scrape_interval: 10s

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'node_exporter_metrics'
    scrape_interval: 5s
    static_configs:
      - targets: ['mockapi:9100']

I need a add a new job which scrapes at https://www2.abc.abc.com/servlet/metrics/

So far all my metrics were on http but this one is on https.

1

1 Answers

8
votes

Add a new job that configures both a custom metrics path and scheme.

It would look something like this:

- job_name: new-job
  scrape_interval: 5s
  static_configs:
    - targets: ['www2.abc.abc.com:443']

  metrics_path: /servlet/metrics/
  scheme: https

Port 443 is the HTTPS port, scheme: https makes sure the HTTPS protocol is uses and metrics_path points to your custom path with the metrics handler.