首页 > 其他分享 >Prometheus prometheus.yml配置文件介绍 2

Prometheus prometheus.yml配置文件介绍 2

时间:2022-12-26 12:44:47浏览次数:62  
标签:配置文件 job global prometheus 默认 Prometheus scrape configs

下面是prometheus.yml的一个配置示例, 非默认示例,自己加了canal和ebs-python-crawler二个job

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["47.107.88.98:9090"]

  - job_name: 'canal'
    static_configs:
      - targets: ['120.24.69.134:11112','47.106.160.176:11112']

  - job_name: 'ebs-python-crawler'
    static_configs:
            - targets: ['120.79.188.142:9410','47.106.160.176:9410','120.24.69.134:9410']

  配置文件有三个配置块: global, rule_files, 和 scrape_configs

1.global

  在prometheus安装后,官方会提供一个默认的prometheus.yml文件,其中包含global的默认配置内容。global块为prometheus服务器的全局配置,主要有三个参数:

    1)scrape_interval: 每次数据采集的时间间隔,默认15一次。

    2)scrape_timeout:采集请求超时时间,默认为10秒。

    3)evaluation_interval :执行rule的频率,默认15秒。 prometheus使用规则来创建新的时间序列并生成警报。

2.scrape_configs

  scrape_configs主要用于配置被采集数据节点操作,每一个采集配置主 有以下几个参数:

    1) job_name 全局唯一名称

    2) scrape_interval 默认等于global内设置的参数值,设置后可以覆盖global中的值。

    3) scrape_timeout 默认等于global内设置的参数值。

    4) metrics_path 从targets 获取metric的HTTP资源路径,默认是/metrics。

    5) scheme 用于请求的协议方式,默认是http。

    6)Params:数据采集访问时HTTP URL设定的请求参数。

     更多参数见下面官方文档链接

    默认配置中,只监控自己job_name:“prometheus”,它会抓取prometheus服务器公开的时间序列数据。该作业包含一个静态配置的目标,默认的作业是通过抓取http://localhost:9090/metrics的url指标站点。

 最后配置完成后,需要我们重新启动prometheus或进行动态热加载操作,使修改后的配置文件加载生效。现在在浏览器中输入http://localhost:9090/targets?search=  可查看配置好的采集数据状态。

 

   官方文档:https://prometheus.io/docs/prometheus/latest/configuration/configuration/     

 

标签:配置文件,job,global,prometheus,默认,Prometheus,scrape,configs
From: https://www.cnblogs.com/MrHSR/p/16728083.html

相关文章

  • Prometheus PromQL
    一.概述Prometheus提供了一种功能强大的表达式语言PromQL(PrometheusQueryLanguage)。PromQL允许用户实时选择和汇聚时间序列数据,是Prometheus自已开发的数据查询DSL......
  • Prometheus pushgateway(不发布)
    一.概述 前面讲到Exporter章节时,讲到了Prometheus服务器运行作业以从目标中获取指标。而指标的获取均是基于pull,即拉取模式的架构。然而在某些情况下,会出现无法从中......
  • Prometheus监控之检查工具Promtool TSDB
    一、概述Promtool在TSDB方面一个有6个子命令,分别用来进行写性能测试、TSDB分析、列出TSDB数据块、dump、从OpenMetric导入数据块、为新的记录规则创建数据块二、TSDB1、写性......
  • android中配置文件property的用途以及使用
    1.首先在源代码根目录(src下)下创建一个名为netconfig.properties的文件(也可以在其他目录下)。2.打开netconfig.properties文件,在该文件中添加下列代码.Java代码:#该......
  • 【踩坑】Debian编译安装Podman和Prometheus-podman-exporter
    这个月一直在折腾Grafana,中途遇到了各种各样的问题这两天折腾得差不多了,才有空把遇到的问题写出来一方面做个记录,另一方面也当给想要折腾的小伙伴们踩踩坑估计最近......
  • Vue之vue.config.js配置文件
    使用vueinspect>output.js可以查看到Vue脚手架的默认配置。使用vue.config.js可以对脚手架进行个性化定制,详情见:https://cli.vuejs.org/zh其中这个配置文件需要和pa......
  • 高可用kube-prometheus 5分钟快速搭建
    项目地址​​prometheus-operator/kube-prometheus:UsePrometheustomonitorKubernetesandapplicationsrunningonKubernetes(github.com)​​1.初识prometheus1.......
  • Prometheus监控之检查工具Promtool简介
    一、简介Prometheus提供了一个非常有用的支持命令行工具promtool。这个小型的Golang二进制文件可用于快速执行包括查询指标、debug服务、对数据库进行检查等等故障排除操作......
  • Prometheus监控之检查工具Promtool check
    一、检查服务发现使用Promtool可以检查配置文件中的服务发现配置,防止配置错误导致程序无法启动,或者启动后无法正常发现内容。具体命令参数为promtoolcheckservice-disco......
  • PORT模式已成功,请更新您的站点配置文件
    如何在FlashFXP中设置连接FTP服务器的模式为PORT呢? FlashFXP提供了两种连接FTP服务器的方式被动模式(PASV)、主动模式(PORT),而FlashFXP的默认设置为被动模式(PASV),更改FlashFXP将......