Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add https url on target prometheus

I want to add my HTTPS target URL to Prometheus, an error like this appears:

"https://myDomain.dev" is not a valid hostname"

my domain can access and run using proxy pass Nginx with port 9100(basically I made a domain for node-exporter)

my configuration prometheus.yml

scrape_configs:
  - job_name: 'prometheus'

    static_configs:
    - targets: ['localhost:9090']

  - job_name: 'domain-job'
    static_configs:
    - targets: ['https://myDomain.dev']

is there any more configuration to add?

like image 953
Yohanes Avatar asked Dec 23 '22 15:12

Yohanes


2 Answers

Use the following configuration:

  - job_name: 'domain-job'
    scheme: https
    static_configs:
    - targets: ['myDomain.dev']
like image 97
Marcelo Ávila de Oliveira Avatar answered Jan 04 '23 17:01

Marcelo Ávila de Oliveira


Besides configuring the https scheme, if you need to skip the tls or need to configure a bearer token, this config will work:

job_name: 'spring-actuator'
  scheme: https
  authorization:
      type: Bearer
      credentials: <your_token>
  tls_config:
      insecure_skip_verify: true
  metrics_path: '/actuator/prometheus'
  scrape_interval: 5s
  static_configs:
    - targets: ['your_ip:your_port']

If you need other configuration, this reference might help you.

like image 41
jumping_monkey Avatar answered Jan 04 '23 15:01

jumping_monkey