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']
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
- job_name: 'node'
|
- job_name: 'node'
|
||||||
|
|
||||||
# metrics_path defaults to '/metrics'
|
|
||||||
# scheme defaults to 'http'.
|
|
||||||
metrics_path: /node_exporter/metrics
|
metrics_path: /node_exporter/metrics
|
||||||
|
|
||||||
file_sd_configs:
|
consul_sd_configs:
|
||||||
- files:
|
- server: 'localhost:8500'
|
||||||
- '/etc/prometheus.d/targets/targets.yml'
|
services:
|
||||||
|
- 'node_exporter'
|
||||||
|
|
||||||
alerting:
|
alerting:
|
||||||
alertmanagers:
|
alertmanagers:
|
||||||
|
|
|
@ -7,6 +7,15 @@ remote_file '/etc/supervisor/conf.d/node_exporter.conf' do
|
||||||
notifies :restart, 'service[supervisor]'
|
notifies :restart, 'service[supervisor]'
|
||||||
end
|
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
|
service 'supervisor' do
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue