首页 > 其他分享 >Prometheus笔记-file_sd_config

Prometheus笔记-file_sd_config

时间:2023-01-17 13:33:06浏览次数:45  
标签:配置文件 Prometheus scrape job file prometheus config yml

一般一个job作为一个业务服务,它下面的监控的机器/节点都是这个服务的节点,为了方便管理,我们可以按照job划分,为每个job创建一个子配置文件,这样方便管理

配置文件

# my global config
global:
  scrape_interval: 15s # #每15s采集一次数据
  evaluation_interval: 15s #每15s做一次告警检测.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration(告警配置)
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# rule_files 加载告警规则文件
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # 定义一个job名称
  - job_name: "prometheus"

    # 默认指标地址 '/metrics'
  	metrics_path: '/metrics'
    # scheme defaults to 'http'.
    scheme: 'http'

	  # 基于文件的服务发现提供了一种更通用的方法来配置静态目标,子配置文件支持json和yaml
    file_sd_configs:
      - files: ["./child_config/prometheus.yml"]

创建子配置文件目录

[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# mkdir -p child_config

创建子配置文件

[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# cd child_config
[root@VM-24-9-centos prometheus-2.41.0.linux-amd64]# touch prometheus.yml
- targets: ["localhost:9090"]
  labels:
    env: 'test'
    host: 'localhost'

显示效果

image.png

标签:配置文件,Prometheus,scrape,job,file,prometheus,config,yml
From: https://www.cnblogs.com/jruing/p/17057602.html

相关文章

  • LOG_FILE_NAME_CONVERT
    一、概述本文详解oracle的dg环境参数:LOG_FILE_NAME_CONVERTDB_FILE_NAME_CONVERT二、解决方案2.1 LOG_FILE_NAME_CONVERT财产描述参数类型细绳句法L......
  • configparse模块
    configparse模块转发:https://www.cnblogs.com/zhou2019/p/10599953.html一、ConfigParser简介ConfigParser是用来读取配置文件的包。配置文件的格式如下:中括号“[]......
  • JS二进制:File、Blob、FileReader、ArrayBuffer、Base64
    JavaScript提供了一些API来处理文件或原始文件数据,例如:File、Blob、FileReader、ArrayBuffer、base64等。  Blob全称为binarylargeobject,即二进制大对象,它是......
  • 9.Requests【接口请求】POST请求的files格式请求体传参(文件上传)
    一、前言前面的课程中已经学习了两种POST请求中文件的传输格式,还有一种格式,Content-Type:multipart/form-data时的传参方式,这种数据传输方式的接口一般是文件上传接口,可......
  • Python之configparser模块详解和使用
    (目录)1configparser安装pip3installconfigparser2configparser简介用来读取配置文件的python包;一般做自动化测试的时候,会使用到这个模块,用来封装一些常量。比如......
  • 手把手教你写Dockerfile以及测试
    Dockerfile是什么?dockerfile就是用来构建docker镜像的构建文件,命令参数脚本。如何使用Dockerfile?1、编写一个Dockerfile文件2、dockerbuild构建成基础使用(此处罗......
  • 9.使用JavaConfig实现配置
    要完全不使用Spring的xml配置了,全权交给Java来做!JavaConfig是Spring的一个子项目,在Spring4之后,它成为了一个核心功能!实体类packagecom.zuo.entity;importorg.sp......
  • Prometheus由于时间不同步导致数据不显示
    问题部署prometheus后,访问前端界面发现:这是由于你windows机器与部署prometheus服务器的​​时间不同步​​导致的。解决在服务器执行如下命令:ntpdatentp.aliyun.com就能......
  • Prometheus Operator配置Alertmanager告警
    1、管理Alertmanagerconfiguration1.1方式一,使用存储在Kubernetessecret中的本地Alertmanager配置文件1、编写alertmanager配置alertmanager.yamlroute:group_by......
  • mac虚拟环境Reason: tried: '/usr/local/lib/libmysqlclient.21.dylib' (no such file
    关于django链接数据库时,出现了找不到lib/libmysqlclient.21.dylib的问题。在网上百度了好久,终于用如下的命令解决了。版本信息虚拟环境python=3.7MYSQL=8.0.31mysqlc......