scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node'
static_configs:
- targets: ['11.11.11.111:9100', '11.11.11.112:9100', '11.11.11.113:9100']
- job_name: node
file_sd_configs:
- files:
- targets/nodes/*.json
refresh_interval: 5m
- job_name: docker
file_sd_configs:
- files:
- targets/docker/*.json
refresh_interval: 5m
cd /etc/prometheus
mkdir -p targets/{nodes,docker}
touch targets/nodes/nodes.json
touch targets/docker/daemons.json
[{
"targets": ["138.197.26.39:9100", "138.197.30.147:9100", "138.197.30.163:9100"]
}]
[{
"targets": ["138.197.26.39:8080", "138.197.30.147:8080", "138.197.30.163:8080"]
}]
- targets:
- "138.197.26.39:8080"
- "138.197.30.147:8080"
- "138.197.30.163:8080"
[{
"targets": ["138.197.26.39:8080", "138.197.30.147:8080", "138.197.30.163:8080"],
"labels": {"datacenter": "nj"}
}]
- job_name: webapp
dns_sd_configs:
- names: ['_prometheus._tcp.example.com']
_service._proto.name. TTL IN SRV priority weight port target.
_prometheus._tcp.example.com 300 IN SRV 10 1 9100 webapp1.
_prometheus._tcp.example.com 300 IN SRV 10 1 9100 webapp2.
_prometheus._tcp.example.com 300 IN SRV 10 1 9100 webapp3.
webapp1.example.com
webapp2.example.com
webapp3.example.com
- job_name: webapp
dns_sd_configs:
- names: ['example.com']
type: A
port: 9100
- job_name: webapp
dns_sd_configs:
- names: ['web.example.com']
type: A
port: 9100