Prometheus--安装

傻男人 1年前 ⋅ 540 阅读

Prometheus 安装

docker安装的方式

创建挂载盘符

mkdir -p /mount/promethues
mkdir -p /mount/promethues/server
mkdir -p /mount/promethues/client
touch /mount/promethues/server/rules.yml
touch /mount/promethues/server/prometheus.yml
chmod 777 /mount/promethues/server/rules.yml

添加配置文件内容prometheus.yml

global:
  scrape_interval:     60s
  evaluation_interval: 60s
 
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
        labels:
          instance: prometheus
 
  - job_name: linux
    static_configs:
      - targets: ['172.16.20.156:9100']
        labels:
          instance: linux
  - job_name: docker
    static_configs:
      - targets: ['172.16.20.156:8060']
        labels:
          instance: docker

docker启动

docker run --name=prometheus -d -p 9090:9090 \
-v /mount/promethues/server/prometheus.yml:/etc/prometheus/prometheus.yml \
-v /home/promethues/server/rules.yml:/etc/prometheus/rules.yml \
prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--web.enable-lifecycle

访问地址

http://172.16.20.156:9090/graph


全部评论: 0

    我有话说: