基于文件的服务发现方式不需要依赖其他平台与第三方服务,用户只需将要新的target信息以yaml或json文件格式添加到target文件中 ,prometheus会定期从指定文件中读取target信息并更新。

target文件

vim /usr/local/prometheus-2.1/targets.json
[
{
"targets": [ "192.168.20.136:9100"],
"labels": {
"instance": "nodeone",
"job": "expor_test1"
}
}, {
"targets": [ "localhost:9090"],
"labels": {
"job": "prometheus"
}
}, {
"targets": [ "192.168.20.137:9100"],
"labels": {
"instance": "nodetwo",
"job": "expor_test2"
}
}
]

Prometheus配置文件

global:
scrape_interval: 15s
evaluation_interval: 15s alerting:
alertmanagers:
- static_configs:
- targets: ['localhost:9093'] rule_files:
# - "/usr/local/prometheus-2.1/rule.yml"
# - "/usr/local/prometheus-2.1/rule2.yml" scrape_configs: - job_name: 'file_ds' #此处定义了自动发现的采集任务
file_sd_configs:
- files:
- targets.json #采集文件名

启动prometheus

./prometheus &

查看web界面targets 出现targets.json 所定义的3个job。

prometheus — 基于文件的服务发现的更多相关文章

  1. Prometheus 基于文件的服务发现

    Prometheus 基于文件的服务发现 官方文档:https://github.com/prometheus/prometheus/tree/master/discovery 服务发现支持: end ...

  2. Prometheus基于文件的服务发现

    Prometheus基于文件的服务发现 一.基于文件的服务发现 1.prometheus.yml 配置文件的写法 2.file_sd 目录下的文件 3.配置结果 二.注意事项 三.参考链接 一.基于文 ...

  3. Prometheus基于Eureka的服务发现

    Prometheus基于Eureka的服务发现 一.背景 二.实现步骤 1.eureka 客户端注册到prometheus中 2.prometheus中的写法 3.实现效果 三.完整代码 四.参考链接 ...

  4. prometheus 基于文件的目标发现

    prometheus 基于文件的目标发现 1.创建目录 cd /usr/local/prometheus/conf mkdir -pv targets/{nodes,docker} 2.修改prome ...

  5. prometheus 基于DNS的目标发现

    prometheus 基于DNS的目标发现 DNS服务发现依赖于查询A.AAAA或SRV DNS记录. 1.基于 SRV 记录发现 scrape_configs: - job_name: 'webap ...

  6. Prometheus Consul实现自动服务发现

    Prometheus Consul实现自动服务发现   1.概述 Consul 是一个支持多数据中心分布式高可用的服务发现和配置共享的服务软件. Consul 由 HashiCorp公司用Go语言开发 ...

  7. Ocelot + Consul + Registrator 基于Docker 实现服务发现、服务自动注册

    目录 1. Consul集群搭建 1.1 F&Q Consul官方推荐的host网络模式运行 2. Registrator服务注册工具 2.1 F&Q Registrator悬挂服务 ...

  8. K8s基于DNS的服务发现(转)

    原文地址:https://www.oschina.net/question/2657833_2201246 1.Kubernetes中如何发现服务 ◆   发现Pod提供的服务 首先使用nginx-d ...

  9. prometheus服务发现机制

    一. Prometheus与服务发现 1.1 目前支持的服务发现方式 二. 案例 2.1 基于文件的服务发现 2.2 基于Consul的服务发现 三.本地测试 3.1 基于文件的服务发现 1.测试环境 ...

随机推荐

  1. CoordinatorLayout 嵌套 AppBarLayout RecyclerView ,通过代码控制,使得CoordinatorLayout 自动滑动到tab置顶的位置

    有两个方式可以实现 一:调用AppBarLayout,设置间距 val behavior = (appbar_layout.getLayoutParams() as CoordinatorLayout ...

  2. Abd学习笔记

    Abd学习笔记 V快捷键:转正坐标 Tab快捷键:切换xyz或是长度角度 空格键快捷键:切换长度或弧度 Enter快捷键:确定方向x或y O快捷键:做辅助线 E:切换平面,分别有t,f,s Ra:创建 ...

  3. Windows XP 的最高版本 .net framework 安装

    注意: Windows XP 系统已于2014年4月8日停止维护.出于安全.性能及新设备支持考虑,应立即停止使用. 安装 Windows XP SP3 所支持的最高.net framework 版本为 ...

  4. ELK全Dokcer 部署

    环境准备: docker-complete 解压 su root 进入目录 rpm -Uvh *.rpm 安装docker systemctl start docker systemctl enabl ...

  5. centos7 把终端显示改为英文/中文

    把终端显示改为英文: 1.先备份语言配置文件 cp /etc/locale.conf /home/locale.conf.backup 2.打开配置文件 vim /etc/locale.conf 3. ...

  6. 【easy】653. Two Sum IV - Input is a BST

    BST树求得两个节点的和是target //因为是BST所以中序遍历得到的是递增数组 //这个题的方法就是在一个递增数组中找到两个数的和相加是目标结果 /** * Definition for a b ...

  7. table td中的内容过长,显示为固定长度,多余部分用省略号显示

    简单描述:table数据过长,结果顶到下一格,影响了数据的查看 解决办法: 给table 加上style属性   另外 给td加上style标签修饰 <table class="tab ...

  8. AFNetWroking 3.0 GET&POST基本使用

    ``` - (void)requestWithUrl:(NSString *)url params:(NSDictionary *)params methodType:(NSString *)meth ...

  9. 【玩转开源】BananaPi R2 —— 第三篇 基于Openwrt开发一个简单的路由器

    上一篇讲解了R2的网口配置,这一篇我们以BananaPi R2为例子来实现一个简单的路由器:那么一个简单的路由器应该具备什么样的功能呢?最简单的说就是wan+lan+ap这三个功能. 首先wan+la ...

  10. nginx实现Ipv6地址解析

    nginx实现Ipv6地址解析 1.nginx实现Ipv6地址解析 [root@ip-10-109-1-47 conf]# cat nginx.conf worker_processes 2; eve ...