docker 部署Prometheus Prometheus-node Grafana
一 部署prometheus-server
1.拉取镜像
docker pull prom/prometheus:v3.14.0
2.创建目录
mkdir /home/prometheus
cd /home/prometheus\
3.编写启动脚本和配置文件
[root@localhost prometheus]# cat docker-compose.yml
services:
prometheus:
image: prom/prometheus:v3.14.0
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- /home/prometheus/data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=30d"
- "--web.enable-lifecycle"
environment:
TZ: Asia/Shanghai
[root@localhost prometheus]# cat prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets:
- "****************:9090"
- job_name: "node"
static_configs:
#1
- targets:
- *************:9100"
labels:
server_name: "edu-jf-test"
#2
- targets:
- "************:9100"
labels:
server_name: "edu-cj"
启动服务
docker-copmoes up -d
浙公网安备 33010602011771号