首页 > 其他 > 详细

Prometheus服务发现的几种方式

时间:2021-09-01 21:27:20      阅读:9      评论:0      收藏:0      [点我收藏+]

基于配置文件

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服务发现的几种方式

原文:https://www.cnblogs.com/yanshicheng/p/15194319.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!