Prometheus服务发现的几种方式

基于配置文件

scrape_configs:
   ...
          
  - job_name: "nodes"
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: http
    static_configs:
      - targets:
        - 192.168.168.106:9100
        - 192.168.168.105:9100

基于文件

[root@ops ~]# cd /opt/prometheus
[root@ops prometheus]# mkdir targets
[root@ops prometheus]# cd targets/
[root@ops targets]# cat prometheus-server.yml 
- targets:
  - 127.0.0.1:9090
  labels:
    app: prometheus-server

[root@ops targets]# cat nodes-linux.yml 
- targets:
  - 192.168.168.106:9100
  - 192.168.168.105:9100
  labels:
    app: node_exporter

# 主配置文件

scrape_configs:
  - job_name: "prometheus"
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: http
    file_sd_configs:
    - files:
      - targets/prometheus-*.yml
      refresh_interval: 1m

  - job_name: "nodes"
    honor_timestamps: true
    scrape_interval: 15s
    scrape_timeout: 10s
    metrics_path: /metrics
    scheme: http
    file_sd_configs:
    - files:
      - targets/nodes-*.yml
      refresh_interval: 1m

基于 Consl

基于DNS

基于Kubernetes API

 

Prometheus服务发现的几种方式

上一篇:Virtualbox mouse move in and out and file share with windows


下一篇:【高德地图API】从零开始学高德JS API(八)——地址解析与逆地址解析