# Prometheus-Master

**新建Prometheus持久化目录及文件**

```
mkdir /etc/prometheus/{configs,rules} -p
vim /etc/prometheus/prometheus.yml
```

```
global:
  scrape_interval:     15s
  evaluation_interval: 15s
alerting:
  alertmanagers:
  - static_configs:
    - targets:
       - 127.0.0.1:9093
rule_files:
  - "rules/*.yml"
scrape_configs:
  - job_name: '卡片联邦监控'
    honor_labels: true
    metrics_path: '/federate'
    params:
      'match[]':
        - '{job="国内"}'
        - '{job="海外"}'
    static_configs:
    - targets: ['IP:9090']
    - targets: ['IP:9090']
```

**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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ilinux.gitbook.io/prometheus/prometheusmaster-bu-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
