Multple Hostname per IP

53 views
Skip to first unread message

Rafael Quintela

unread,
Jul 7, 2020, 10:00:32 PM7/7/20
to Prometheus Users
I need to scrap metrics from many servers running docker-compose(multiple applications each) and a reverse proxy(nginx, traefik, etc..).

Example;
curl https://app1.io/metrics --resolve "app1.io:443:99.84.16.181"
curl https://app2.io/metrics --resolve "app2.io:443:99.84.16.181"
curl https://app3.io/metrics --resolve "app2.io:443:99.84.16.181"

So, how can I target multiple hostname on the same IP/DNS address?

Warren Pang

unread,
Jul 7, 2020, 10:31:56 PM7/7/20
to Rafael Quintela, Prometheus Users
You want to setup domain based virtual hosts in backend web server. 

Thanks 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/bf0c17fc-6fb3-4c26-8b98-6aef338387ddo%40googlegroups.com.

Rafael Quintela

unread,
Jul 8, 2020, 7:19:17 AM7/8/20
to Prometheus Users
How do I configure my prometheus.yaml to scrap metrcis from my domain based backend web server?

Is it even possible? or should I just set up a Prometheus Federation since threre is no other way?


Em terça-feira, 7 de julho de 2020 23:31:56 UTC-3, Warren Pang escreveu:
You want to setup domain based virtual hosts in backend web server. 

Thanks 
On Wed, Jul 8, 2020 at 10:00 AM Rafael Quintela <rafa...@gmail.com> wrote:
I need to scrap metrics from many servers running docker-compose(multiple applications each) and a reverse proxy(nginx, traefik, etc..).

Example;
curl https://app1.io/metrics --resolve "app1.io:443:99.84.16.181"
curl https://app2.io/metrics --resolve "app2.io:443:99.84.16.181"
curl https://app3.io/metrics --resolve "app2.io:443:99.84.16.181"

So, how can I target multiple hostname on the same IP/DNS address?

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Brian Candler

unread,
Jul 11, 2020, 4:14:22 PM7/11/20
to Prometheus Users
On Wednesday, 8 July 2020 12:19:17 UTC+1, Rafael Quintela wrote:
How do I configure my prometheus.yaml to scrap metrcis from my domain based backend web server?


If app1.io, app2.io and app3.io all resolve to the correct IP address, then just scrape app1.io, app2.io and app3.io.  If they don't, then the easiest solution is to put an entry in /etc/hosts so that they do:

99.84.16.181 app1.io app2.io app3.io

If not, then it gets messy when using https.  You need to use server_name to tell prometheus what virtual host to connect to (SNI).  I don't *think* there is a way to do this using special labels, so it means a separate scrape job per host:

job_name: app1.io
  tls_config:
    server_name: app1.io
  static_configs:
    - targets: [99.84.16.181]

job_name: app2.io
  tls_config:
    server_name: app2.io
  static_configs:
    - targets: [99.84.16.181]

Reply all
Reply to author
Forward
0 new messages