Hi!
I have some sort of basic question on how to monitor/scrape metrics from various places. My setup is as follows:
* one server with mailserver, reverse proxy and various docker services
* one server for prometheus (different location, different hoster)
I want to monitor all services on my multi purpose server (with different exporters). I have the node_exporter, the blackbox_exporter and a bunch of own custom exporters from my docker services. All this exporters expose local http endpoints to provide the data. But I don't want to expose this to the internet over http without a authentication mechanism. So I put a reverse proxy in front of it and add basic auth (and tls). This is a snipped from my nginx config:
---
use_ssl;
[...]
location /docker {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /metrics {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
[...]
---
On prometheus, I add it like this:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: vpsfu-node
scheme: https
basic_auth:
username: ***
password: ***
tls_config:
insecure_skip_verify: true
static_configs:
- job_name: vpsfu-docker
scheme: https
metrics_path: /docker
basic_auth:
username: ***
password: ***
tls_config:
insecure_skip_verify: true
static_configs:
[...]
This works, but my guts says me that this is not the right way to do it.
What is the proper way of doing this?
Is there a way I can combine all metrics endpoints into a single one? Or I am completely wrong and this is the way to go?
Aaron