Accessing a subset of prometheus endpoints over SSL+auth

Prometheus configuration to scrape from such a node behind SSL and basic auth. Assumes your Prometheus scrape target has a pukka SSL/TLS server certificate (otherwise use your own CA etc.).

    - job_name: node
          - targets:
              - localnode:9100
    - job_name: sslauthnode
      # Gather some node 
      scheme: https
          username: prometheus
          password: my_plain_text_password_here
          - targets:
                - my.example.fqdn:8443
                - other.example.fqdn:8443
      # Obtionally relabel these nodes to get the same job label as their non-ssl, non-auth counterparts do
          - source_labels: ['job']
            regex:         'sslauth(.+)'
            target_label:  'job'
            replacement:   '$1'

You will need to take steps to add SSL and authentication to your prometheus scrape target e.g. see haproxy-reverse-proxy-for-prometheus-with-ssl-and-auth

Rate this tip

If you think this tip by TimSmallTimSmall is useful — rate it up!

rating: +1+x
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License