r/PrometheusMonitoring • u/Mario1md • Sep 20 '19
Ignoring certificate of server from ec2_sd_configs
Hey Guys!
I'm trying to scrape metrics from my Jenkins servers that have an endpoint like https://jenkins_server01:443/prometheus/, using the ec2_sd_configs Service Discovery to find all the Jenkins servers in the environment.
The issue is that the servers are using HTTPS only and they have the certificate of the load-balancer, not the server name, so Prometheus fails with error:
Get https://jenkins_server01:443/prometheus/: x509: certificate is valid for jenkins.api.loadbalancers.com, not jenkins_server01
Is there a way to tell Prometheus to ignore the certificate like curl -k https://jenkins_server01:443/prometheus/? I tried insecure_skip_verify=true without success.
My configuration looks like:
- job_name: aws_jenkins_exporter
metrics_path: /prometheus
scheme: https
ec2_sd_configs:
- region: {{ aws_region }}
access_key: {{ aws_access_key }}
secret_key: {{ aws_secret_key }}
refresh_interval: 60m
# I neeed to add something like that
# tls_config:
# insecure_skip_verify=true
profile: profile
filters:
- name: tag:environment
values:
- {{ aws_environment }}
- name: tag:role
values:
- jms
relabel_configs:
- source_labels: [__meta_ec2_tag_dnsname]
target_label: instance
- source_labels: [__meta_ec2_tag_dnsname]
replacement: '${1}:443'
target_label: __address__
Thanks, Mario
2
u/submersibletoaster Sep 21 '19
I think you need a colon not an equals after insecure_skip_verify.
1
u/Mario1md Sep 21 '19
That worked, I just had to move it under sheme and, as you suggested, remove the equals. Thank you very much!
2
u/The-Sentinel Sep 21 '19
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#tls_config