一、prometheus安装
# 1.拉镜像
docker pull prom/prometheus:v2.43.0
# 2.创建配置文件,prometheus官方不支持nacos,第三方支持不好,问题较多,暂时考虑手工配置job
mkdir /opt/prometheus/data
cd /opt/prometheus/
vi prometheus.yml 【见附件:prometheus.yml】
# my global config
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
rule_files:
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
# 配置
- job_name: 'xxxx1-service'
scrape_interval: 10s # 60s
metrics_path: '/prometheus'
static_configs:
- targets: ["192.168.6.45:21330"]
- job_name: 'xxxx2-service'
scrape_interval: 10s # 60s
metrics_path: '/prometheus'
static_configs:
- targets: ["192.168.6.45:21330"]