基于文件的服务发现
创建json配置文件
# mkdir /apps/prometheus/file_sd -p
# vim /apps/prometheus/file_sd/sd_my_server.json
[
{
"targets": ["10.0.0.6:9100"]
}
]
编辑prometheus文件添加job
- job_name: 'file_sd_my_server'
file_sd_configs:
- files:
- /apps/prometheus/file_sd/sd_my_server.json
refresh_interval: 10s #10秒刷新一次
重启prometheus
systemctl restart prometheus.service
访问prometheus