Prometheus-海外-Slave

新建Prometheus持久化目录及文件

mkdir /etc/prometheus/{configs,rules} -p
vim /etc/prometheus/prometheus.yml
global:
  scrape_interval:     15s
  evaluation_interval: 15s
alerting:
  alertmanagers:
  - static_configs:
    - targets:
rule_files:
scrape_configs:
  - job_name: '海外'
##这里采用文件自动发现JOB
    file_sd_configs: 
      - files: ['/etc/prometheus/configs/*.yaml'] 
        refresh_interval: 5s

新建采集任务文件

vim /etc/prometheus/configs/Node-Telegraf.yaml
- targets: ['192.168.1.101:9273','192.168.1.102:9273','192.168.1.103:9273'] 
  labels:
    name: 海外TeleGraf容器监控

Docker运行Prometheus

docker run   --name prometheus   -d -p 9090:9090   -v /etc/hosts:/etc/hosts   -v /etc/prometheus/:/etc/prometheus/   prom/prometheus   --web.read-timeout=5m   --config.file=/etc/prometheus/prometheus.yml   --storage.tsdb.path=/prometheus   --web.max-connections=512   --storage.tsdb.retention=30d   --query.timeout=2m  --web.enable-lifecycle

Last updated