'x509: certificate signed by unknown authority for prometheus

I was trying to monitor one of our Spring boot application using Prometheus but unfortunately the status of this service is not getting UP in ubuntu server, it’s showing some error like –

/prometheus: x509: certificate signed by unknown authority, Where from my local Prometheus this service is UP and also able to monitor some of the http requests. error snapshot



Solution 1:[1]

I have faced the same issue. Solved it by:

Configure Prometheus to ignore ssl verification as suggested by @Shmuel

global:
  scrape_interval:     15s
  external_labels:
    monitor: 'prometheus'

scrape_configs:
  - job_name: 'job-name'

    static_configs:
      - targets:
        - host_name_or_ip_address1
        - host_name_or_ip_address2
        - host_name_or_ip_address2

    scheme: https  # to use https instead of http for scraping

    tls_config:
      insecure_skip_verify: true  # This is the key

Solution 2:[2]

If you are using a self-signed certificate you can add the certificate to the scrape_configs under tls_config:

global:
  scrape_interval:     15s
  external_labels:
    monitor: 'prometheus'

scrape_configs:
  - job_name: 'job-name'

    static_configs:
      - targets:
        - host_name_or_ip_address1

    tls_config:
      ca_file: /path/to/prometheus.crt

    scheme: https

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Venkatesh Mondi
Solution 2 amurra