prometheus.yml格式
时间: 2023-06-28 17:13:07 浏览: 87
prometheus.yml 是用于配置 Prometheus 服务器的 YAML 格式文件。下面是一个示例的 prometheus.yml 文件:
```
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
- job_name: 'mysql'
static_configs:
- targets: ['mysql:9104']
```
该文件包含了全局配置和抓取配置两个部分。
在全局配置中,我们可以设置抓取数据的时间间隔和评估规则的时间间隔。
在抓取配置中,我们可以设置不同的 job_name,每个 job_name 对应一个任务。在每个任务中,我们可以设置多个 targets,每个 target 表示一个被监控的对象。这里我们配置了三个任务:prometheus、node 和 mysql,分别对应监控 Prometheus 服务器自身的状态、监控本机的 Node Exporter、监控 MySQL 数据库的状态。其中,Prometheus 和 Node Exporter 都运行在本机,而 MySQL 运行在另一台机器上,其 IP 地址为 mysql。
阅读全文
相关推荐












