码迷,mamicode.com
首页 > 其他好文 > 详细

Prometheus 基于文件的服务发现

时间:2019-08-02 16:46:22      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:dir   targe   marathon   cli   mil   服务   目录   show   onclick   

Prometheus 基于文件的服务发现

官方文档:https://github.com/prometheus/prometheus/tree/master/discovery

服务发现支持: endpoints,ingress,kubernetes,node,pod,service。
Prometheus也提供了服务发现功能,可以从consul,dns,kubernetes,file等等多种来源发现新的目标。
其中最简单的是从文件发现服务。

技术图片
• azure_sd_configs
• consul_sd_configs
• dns_sd_configs
• ec2_sd_configs
• openstack_sd_configs
• file_sd_configs
• gce_sd_configs
• kubernetes_sd_configs
• marathon_sd_configs
• nerve_sd_configs
• serverset_sd_configs
• triton_sd_configs
Prometheus 支持服务发现的来源:

1、编写配置文件:vim prometheus.yml

scrape_configs:
  - job_name: prometheus
    # 使用基于文件服务发现
    file_sd_configs:
        # 指定服务发现的目录及配置文件
        - files: [/usr/local/prometheus/sd_config/*.yml]
          # 每过5秒动态发现服务配置
          refresh_interval: 5s

2、创建目录

mkdir /usr/local/prometheus/sd_config

3、写入配置文件

vim /usr/local/prometheus/sd_config/test.yml

# 添加本地主机并填入标签
- targets: [localhost:9090]
  labels:
    idc: bj

 

技术图片

Prometheus 基于文件的服务发现

标签:dir   targe   marathon   cli   mil   服务   目录   show   onclick   

原文地址:https://www.cnblogs.com/xiangsikai/p/11289101.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!