安装docker参考:
https://www.jianshu.com/writer#/notebooks/52106212/notes/98326013
docker部署
mkdir /etc/prometheus
cd /etc/prometheus
touch prometheus.yml
prometheus监控自己的yml文件prometheus.yml
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
docker 启动
docker run -d --name prometheus_server -p 9090:9090 -v /etc/prometheus:/etc/prometheus prom/prometheus
测试验证:
浏览器访问:IP:9090端口测试
再次启动脚本start_prometheus.sh
docker stop prometheus_server && docker rm -f prometheus_server
docker run -d --name prometheus_server -p 9090:9090 -v /etc/prometheus:/etc/prometheus prom/prometheus