Use `consul` service discovery to register `prometheus` monitoring.
This commit is contained in:
parent
c13954bfc9
commit
70e78a2af0
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"service": {
|
||||
"name": "node_exporter",
|
||||
"port": 60000
|
||||
}
|
||||
}
|
|
@ -44,14 +44,12 @@ scrape_configs:
|
|||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: 'node'
|
||||
|
||||
# metrics_path defaults to '/metrics'
|
||||
# scheme defaults to 'http'.
|
||||
metrics_path: /node_exporter/metrics
|
||||
|
||||
file_sd_configs:
|
||||
- files:
|
||||
- '/etc/prometheus.d/targets/targets.yml'
|
||||
consul_sd_configs:
|
||||
- server: 'localhost:8500'
|
||||
services:
|
||||
- 'node_exporter'
|
||||
|
||||
alerting:
|
||||
alertmanagers:
|
||||
|
|
|
@ -7,6 +7,15 @@ remote_file '/etc/supervisor/conf.d/node_exporter.conf' do
|
|||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
# Deploy `consul` config for `node_exporter`:
|
||||
remote_file '/etc/consul.d/service-node_exporter.json' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
notifies :restart, 'service[supervisor]'
|
||||
end
|
||||
|
||||
service 'supervisor' do
|
||||
action :nothing
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue