> For the complete documentation index, see [llms.txt](https://ilinux.gitbook.io/prometheus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ilinux.gitbook.io/prometheus/prometheus-guo-nei-slave.md).

# 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: ['IP1:9273','IP2:9273','IP3: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
```
