prometheus 学习(1)

2023-05-16

prometheus 配置文档

(github地址)
https://github.com/prometheus/prometheus/blob/master/docs/configuration/configuration.md
标签学习

global:
  # How frequently to scrape targets by default.
  [ scrape_interval: <duration> | default = 1m ]

  # How long until a scrape request times out.
  [ scrape_timeout: <duration> | default = 10s ] 超时时间

  # How frequently to evaluate rules.
  [ evaluation_interval: <duration> | default = 1m ]

  # The labels to add to any time series or alerts when communicating with
  # external systems (federation, remote storage,  Alertmanager).
  external_labels:(外部系统标签)
     [ <labelname>: <labelvalue> ... ]

# Rule files specifies a list of globs. Rules and alerts are read from
# all matching files.
rule_files:(搜集规则匹配的文件)
  [ - <filepath_glob> ... ]

# A list of scrape configurations.
scrape_configs: (抓取配置)
  [ - <scrape_config> ... ]

# Alerting specifies settings related to the Alertmanager.
alerting:(报警配置)
  alert_relabel_configs:
    [ - <relabel_config> ... ]
  alertmanagers:(报警管理)
    [ - <alertmanager_config> ... ]

# Settings related to the remote write feature.(远程写相关的功能)
remote_write:
  [ - <remote_write> ... ]

# Settings related to the remote read feature.
remote_read:(远程读相关的功能)
  [ - <remote_read> ... ]

上面的标签有些不清楚,但是这些平时用到的频率稍微低一些

主要对scrap-config 进行理解

scrap-config

# The job name assigned to scraped metrics by default.
job_name: <job_name> 这个就是job的名字la,在prothemeus 中可以单独看到这一项

# How frequently to scrape targets from this job.
[ scrape_interval: <duration> | default = <global_config.scrape_interval> ] 采集的间隔啦如果没有配置默认是global_config中指定的啦

# Per-scrape timeout when scraping this job.
[ scrape_timeout: <duration> | default = <global_config.scrape_timeout> ] 和上面一样的啦

# The HTTP resource path on which to fetch metrics from targets.
[ metrics_path: <path> | default = /metrics ] 需要抓取的配置文件/默认是metrics啦

# honor_labels controls how Prometheus handles conflicts between labels that are
# already present in scraped data and labels that Prometheus would attach
# server-side ("job" and "instance" labels, manually configured target
# labels, and labels generated by service discovery implementations).
#
# If honor_labels is set to "true", label conflicts are resolved by keeping label
# values from the scraped data and ignoring the conflicting server-side labels.
#
# If honor_labels is set to "false", label conflicts are resolved by renaming
# conflicting labels in the scraped data to "exported_<original-label>" (for
# example "exported_instance", "exported_job") and then attaching server-side
# labels. This is useful for use cases such as federation, where all labels
# specified in the target should be preserved.
#
# Note that any globally configured "external_labels" are unaffected by this
# setting. In communication with external systems, they are always applied only
# when a time series does not have a given label yet and are ignored otherwise.
[ honor_labels: <boolean> | default = false ]  暂时先不了解这个具体是解决冲突时候的标签啦

# Configures the protocol scheme used for requests.
[ scheme: <scheme> | default = http ] 具体数据请求的格式是http or https

# Optional HTTP URL parameters.
params:
  [ <string>: [<string>, ...] ] 具体请求的HTTP URL

# Sets the `Authorization` header on every scrape request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

# Sets the `Authorization` header on every scrape request with
# the configured bearer token. It is mutually exclusive with `bearer_token_file`.
[ bearer_token: <secret> ]

# Sets the `Authorization` header on every scrape request with the bearer token
# read from the configured file. It is mutually exclusive with `bearer_token`.
[ bearer_token_file: /path/to/bearer/token/file ]

# Configures the scrape request's TLS settings.
tls_config:
  [ <tls_config> ]

# Optional proxy URL.
[ proxy_url: <string> ]

# List of Azure service discovery configurations.
azure_sd_configs:
  [ - <azure_sd_config> ... ]

# List of Consul service discovery configurations.
consul_sd_configs:
  [ - <consul_sd_config> ... ]

# List of DNS service discovery configurations.
dns_sd_configs:
  [ - <dns_sd_config> ... ]

# List of EC2 service discovery configurations.
ec2_sd_configs:
  [ - <ec2_sd_config> ... ]

# List of OpenStack service discovery configurations.
openstack_sd_configs:
  [ - <openstack_sd_config> ... ]

# List of file service discovery configurations.
file_sd_configs:
  [ - <file_sd_config> ... ]

# List of GCE service discovery configurations.
gce_sd_configs:
  [ - <gce_sd_config> ... ]

# List of Kubernetes service discovery configurations.
kubernetes_sd_configs:
  [ - <kubernetes_sd_config> ... ]

# List of Marathon service discovery configurations.
marathon_sd_configs:
  [ - <marathon_sd_config> ... ]

# List of AirBnB's Nerve service discovery configurations.
nerve_sd_configs:
  [ - <nerve_sd_config> ... ]

# List of Zookeeper Serverset service discovery configurations.
serverset_sd_configs:
  [ - <serverset_sd_config> ... ]

# List of Triton service discovery configurations.
triton_sd_configs:
  [ - <triton_sd_config> ... ]

# List of labeled statically configured targets for this job.
static_configs:
  [ - <static_config> ... ]

# List of target relabel configurations.
relabel_configs: 目标重新添加表切的配置
  [ - <relabel_config> ... ]

# List of metric relabel configurations.
metric_relabel_configs:
  [ - <relabel_config> ... ]细节文件标签的配置文档

# Per-scrape limit on number of scraped samples that will be accepted.
# If more than this number of samples are present after metric relabelling
# the entire scrape will be treated as failed. 0 means no limit.
[ sample_limit: <int> | default = 0 ] 

< kubernetes_sd_config >

Kubernetes SD配置允许从Kubernetes的REST API获取刮取目标,并始终与集群状态保持同步。


可以配置以下角色类型之一以发现目标:


node

node角色发现每个集群节点有一个目标,该目标的地址默认为Kubelet的HTTP端口。目标地址默认为NodeInternalIP、NodeExternalIP、nodelegate yhostip和NodeHostName中Kubernetes节点对象的第一个现有地址。


可用的元标签:


__meta_kubernetes_node_name:节点对象的名称。

__meta_kubernetes_node_label_:来自节点对象的每个标签。

__meta_kubernetes_node_annotation_:来自节点对象的每个注释。

__meta_kubernetes_node_address_:每个节点地址类型的第一个地址,如果存在的话。

此外,节点的实例标签将被设置为从API服务器检索到的节点名。


service

service角色为每个服务的每个服务端口发现一个目标。这对于黑盒监视服务通常是有用的。地址将设置为服务的Kubernetes DNS名称和各自的服务端口。


可用的元标签:


__meta_kubernetes_namespace:服务对象的名称空间。

__meta_kubernetes_service_name:服务对象的名称。

__meta_kubernetes_service_label_:服务对象的标签。

__meta_kubernetes_service_annotation_:服务对象的注释。

__meta_kubernetes_service_port_name:目标服务端口的名称。

__meta_kubernetes_service_port_number:目标的服务端口数量。

__meta_kubernetes_service_port_protocol:目标服务端口的协议。

pod

pod角色会发现所有的pod,并将它们的容器暴露为目标。对于容器的每个声明端口,都生成一个目标。如果一个容器没有指定的端口,则为每个容器创建一个无端口目标,通过重新标记手动添加一个端口。


可用的元标签:


__meta_kubernetes_namespace: pod对象的名称空间。

__meta_kubernetes_pod_name: pod对象的名称。

__meta_kubernetes_pod_ip: pod对象的pod IP。

__meta_kubernetes_pod_label_: pod对象的标签。

__meta_kubernetes_pod_annotation_: pod对象的注释。

__meta_kubernetes_pod_container_name:目标地址指向的容器的名称。

__meta_kubernetes_pod_container_port_name:容器端口的名称。

__meta_kubernetes_pod_container_port_number:容器端口的数量。

__meta_kubernetes_pod_container_port_protocol:容器端口的协议。

__meta_kubernetes_pod_ready:为pod的就绪状态设置为true或false。

__meta_kubernetes_pod_node_name:计划在pod上的节点的名称。

__meta_kubernetes_pod_host_ip: pod对象的当前主机IP。

__meta_kubernetes_pod_uid: pod对象的UID。

__meta_kubernetes_pod_controller_kind: pod控制器的对象。

__meta_kubernetes_pod_controller_name: pod控制器的名称。
endpoints (service and endpoints 的关系)

端点角色从列出的服务端点中发现目标。对于每个端点地址,每个端口发现一个目标。如果端点由pod支持,那么pod的所有附加容器端口(不绑定到端点端口)也将被发现为目标。


可用的元标签:


__meta_kubernetes_namespace:endpoints对象的名称空间。

__meta_kubernetes_endpoints_name:端点对象的名称。

对于直接从端点列表中发现的所有目标(那些不是从底层pod中推断出来的目标),附加以下标签:

__meta_kubernetes_endpoint_ready:为端点的就绪状态设置为true或false。

__meta_kubernetes_endpoint_port_name:端点端口的名称。

__meta_kubernetes_endpoint_port_protocol:端点端口的协议。

__meta_kubernetes_endpoint_address_target_kind:某种端点地址目标。

__meta_kubernetes_endpoint_address_target_name:端点地址目标的ingress

如果端点属于服务,则会附加角色的所有标签:服务发现。

对于所有由pod支持的目标,所有角色标签:pod discovery被附加。

入口

入口角色为每个入口路径发现一个目标。这通常用于对ingress的blackbox监控。地址将被设置为入口规范中指定的主机。


可用的元标签:


__meta_kubernetes_namespace:入口对象的名称空间。

__meta_kubernetes_ingress_name: ingress对象的名称。

__meta_kubernetes_ingress_label_:入口对象的标签。

__meta_kubernetes_ingress_annotation_:入口对象的注释。

__meta_kubernetes_ingress_scheme:如果设置了TLS配置,则为https,默认为http。

__meta_kubernetes_ingress_path:来自ingress规范的路径。

下面有个官方的prometheus 的配置文档,一起分析一下

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

prometheus 学习(1) 的相关文章

随机推荐

  • 了解python代码的执行顺序和对if __name__ == '__main__'理解

    进度一 xff1a 前几天 xff0c 我学习python时 xff0c 编写简单的代码 xff0c 一般是这样的 xff1a pi py PI 61 3 14 print 34 this is out 34 def main print
  • 跨域 php处理代码

    放到public index php中 header 39 Content Type text html charset 61 utf 8 39 header 39 Access Control Allow Origin 39 代表允许任何
  • 全日制和非全日制;定向和非定向区别联系

    全日制和非全日制 xff08 在职 xff09 是相对的 定向和非定向是相对的 xff0c 委托培养是定向的一种 一般情况下 xff1a 全日制绝大部分都是非定向的 xff0c 非全日制 xff08 在职 xff09 绝大部分都是定向的 定
  • 马云推出的“天猫精灵”到底有多牛? 细思极恐怖

    这个时代的变化有多莫测 xff1f 开网店 改变银行的马云 xff0c 搞起了机器人 xff01 搞搜索 做地图的百度 xff0c 完成了无人驾驶 xff01 马云又打响一枪 马云大动作不断 三个重磅后 xff0c 今天又打了对手一个措手不
  • Ardupilot -- APM源码笔记四(重制)~ 线程机制

    认识Ardupilot线程 在了解过Ardupilot的链接库之后 xff0c 是时候来认识一下Ardupilot是怎么处理线程了 xff0c 对于从arduino继承过来的setup xff08 xff09 loop xff08 xff0
  • 最简单的python 人脸检测

    本篇文章是最基本的人脸检测 xff0c 没有复杂的算法 xff0c 只是简单的运用了这三个库opencv xff0c numpy xff0c pillow 一 开发环境搭建 我们使用Python自带的IDLE进行编程 xff0c 我使用的电
  • FreeRtos 任务优先级和中断优先级

    首先打出这个标题是为了便于搜索 在这里赘述一下 这两者没有关系 只需要明白的是中断优先级高于任务的优先级 在单片机运行的过程中 中断来了就执行中断服务程序 在free rtos中 任务优先级设置的数值越大 任务的优先级越高 Unix任务优先
  • 嵌入式工程师的经典面试题目

    嵌入式工程师的经典面试题目 预处理器 xff08 Preprocessor xff09 1 用预处理指令 define 声明一个常数 xff0c 用以表明1年中有多少秒 xff08 忽略闰年问题 xff09 define SECONDS P
  • rabbitmq版本升级

    目录 一 背景 二 部署新的mq 三 元数据备份和还原 四 消息数据备份和还原 五 注意 一 背景 因原来rabbitmq版本存在漏洞需升级至最新版本 原来是使用软件包部署 xff0c 升级我采用使用docker compose部署 xff
  • __attribute__

    前言 本文介绍 attribute 的使用方法 attribute 介绍 要了解Linux Kernel代码的分段信息 xff0c 需要了解一下gcc的 attribute 的编绎属性 xff0c attribute 主要用于改变所声明或定
  • 卡尔曼滤波(2):一个简单的例子

    为了说明离散性卡尔曼滤波器的用法 xff0c 我将用一个最简单的例子来进行说明 假设我们现在对一个房间内的温度进行测试 xff0c 房间内温度初值为25 c xff0c 每过一个时间周期 xff0c 温度x都将在上一个周期温度的基础上变动
  • 使用websocket连接Activemq,让前端接收MQTT消息

    使用websocket连接Activemq xff0c 让前端接收MQTT消息 Activemq简介准备工作简单示例 Activemq简介 Apache ActiveMQ is the most popular open source mu
  • Unix时间戳,GPS时间戳 ,UTC时间 , 本地时间

    本地时间 xff1a 计算机显示的时间 本地时间 61 UTC 时间 43 时区 xff08 北京时间是东八区 xff0c 也就是 43 8小时 xff09 unix 时间戳 xff1a UTC时间都是从 xff08 1970年01月01日
  • 详解PID控制算法 位置式和增量式区别 附代码详解

    1PID控制算法 什么是PID PID 控制器以各种形式使用超过了 1 世纪 xff0c 广泛应用在机械设备 气动设备 和电子设备 在工业应用中PID及其衍生算法是应用最广泛的算法之一 xff0c 是当之无愧的万能算法 PID 实指 比例
  • 虚拟机中打开Gazebo闪退的解决办法

    问题 xff1a 在vmware虚拟机中打开Gazebo闪退 原因 xff1a 开启了3D加速 xff0c 但分配的显存太小 xff0c 不足1G无法满足Gazebo的最低要求 解决办法如下 xff1a 1 关闭虚拟机 xff0c 在虚拟机
  • mysql插入千万条随机数据

    因为想测试sql在千万级数据下的优化 xff0c 准备在自己的阿里云数据库插入一千万条数据 xff0c 在网上搜了全是些乱七八糟的 xff0c 于是就自己动手 xff0c 同时也希望和大家分享 xff0c 不足之处还请各位指教 一 建表 1
  • linux C/C++ socket编程

    文章目录 前言linux socket api介绍简单客户端例子简单的服务端上述程序的问题epoll 前言 我们都知道socket编程实际上是使用tcp或者udp协议进行消息传输 xff0c 所以我们要更为的了解tcp udp协议 tcp三
  • 实现loading加载效果带百分比进度

    html lt div class 61 34 d loading 34 id 61 34 loading 34 gt lt div class 61 34 d loadVpic 34 gt lt div class 61 34 d opc
  • 什么是事件流?

    一 事件流的定义 页面触发一个事件时 xff0c 会按照一定的顺序来响应事件 xff0c 事件的响应过程为事件流 就我个人理解就是网页对点击事件的排序顺序就是事件流 二 事件流的分类 1 冒泡型的事件流 xff08 任何一款浏览器都支持 x
  • prometheus 学习(1)

    prometheus 配置文档 github地址 https github com prometheus prometheus blob master docs configuration configuration md 标签学习 glo