普罗米修斯监控硬盘报警怎么写yaml
时间: 2023-10-13 21:24:53 浏览: 171
Promethus(普罗米修斯)监控系统
下面是一个简单的普罗米修斯监控硬盘报警的YAML示例:
```yaml
scrape_configs:
- job_name: 'disk-space'
static_configs:
- targets: ['localhost']
metrics_path: /metrics
params:
module: [diskstats]
relabel_configs:
- source_labels: [__name__]
regex: '(disk_io_now|disk_io_time|disk_io_time_weighted)'
action: keep
- source_labels: [__name__]
regex: 'disk_io_now'
action: replace
target_label: type
replacement: 'read_write'
- source_labels: [__name__]
regex: 'disk_io_time'
action: replace
target_label: type
replacement: 'read_write_time'
- source_labels: [__name__]
regex: 'disk_io_time_weighted'
action: replace
target_label: type
replacement: 'read_write_time_weighted'
- source_labels: [__name__, device]
regex: 'disk_io_now{device="sda"}'
action: keep
- source_labels: [__name__, device]
regex: 'disk_io_time{device="sda"}'
action: keep
- source_labels: [__name__, device]
regex: 'disk_io_time_weighted{device="sda"}'
action: keep
rule_files:
- 'rules/disk-space.rules.yml'
alerting:
alertmanagers:
- static_configs:
- targets:
- 'localhost:9093'
```
在这个示例中,我们定义了一个名为“disk-space”的作业,该作业监控本地主机上的硬盘空间。我们还定义了一些重新标签的规则,以便更好地组织和显示监控数据。最后,我们将监控数据的规则文件和警报管理器的配置文件包含在内。
阅读全文