Docker安装prometheus
# 拉取镜像
docker pull prom/prometheus:v2.22.0
# 创建配置文件
mkdir -p /opt/prometheus/
cd /opt/prometheus
vim prometheus.yml
global:
scrape_interval: 60s
evaluation_interval: 60s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: prometheus
# 运行容器
docker run -d --name prometheus -p 9090:9090 -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:v2.22.0
浏览器访问:http://宿主机ip:9090