prometheus.yaml
这是Prometheus的主要配置,具体挂载问题请看上一篇部署文档yaml
global:
# 采集频率:30s
scrape_interval: 30s
# 采集超时:10s
evaluation_interval: 10s
scrape_configs:
# 全局唯一
- job_name: prometheus
# 采集对象的path路径
metrics_path: /metrics
# 采集协议:http或者https
scheme: http
static_configs:
- targets: ['10.0.0.60:9100']
#以文件的形式添加导出器,容易维护,美观
- job_name: 'vos_node'
file_sd_configs:
- files: ['/usr/local/data/prometheus/config/prometheus_jobs_conf/job1.yaml']
#以文件的形式添加导出器,容易维护,美观
- job_name: 'key_node'
file_sd_configs:
- files: ['/usr/local/data/prometheus/config/prometheus_jobs_conf/job2.yaml']
#job_name类似分组,在Prometheus中会区分出不同的监控组
- job_name: 'qmyhuaweiyun01'
file_sd_configs:
- files: ['/usr/local/data/prometheus/config/prometheus_jobs_conf/qmyhuaweiyun01.yaml']
#以静态配置的形式添加导出器.跟上面比起来不美观,也不好维护.
- job_name: 'job_node'
static_configs:
- targets: ['10.0.0.52:9100']
labels:
instance: 10.0.0.52-test
#黑盒探测器的配置信息.
- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- http://sms.danmi.com/operate/ # Target to probe with http.
- https://www.baidu.com # Target to probe with http.
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox:9115 # The blackbox exporter's real hostname:port.其他的不需要改.只需要改这里.根据实际更改.
#altermanager的配置信息
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093
rule_files:
- "/usr/local/data/prometheus/config/alert_conf/first.rules"
- "/usr/local/data/prometheus/config/alert_conf/*.yml"
动态配置格式
- targets: ['12X.XXX.XXX.X5:9100']
labels:
instance: 这里写描述