Prometheus笔记-Label标签

Label

Lable是为了方便管理及查询监控目标,在后续写promtheus查询语法的时候需要使用标签作为查询条件

配置文件

# 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'
# 静态指定每一个监控目标
static_configs:
# 监控目标节点地址,可以并列写入多个目标节点地址(格式为 机器ip:端口),以逗号隔开
- targets: ["localhost:9090"]
# 标签
labels:
env: 'test'

上文配置文件17,18两行实现了新增一个label标签 env

显示效果

image.png
注意:在修改配置文件后,需要重启Prometheus服务

作者:jruing

出处:https://www.cnblogs.com/jruing/p/17057597.html

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   Jruing  阅读(563)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
more_horiz
keyboard_arrow_up light_mode palette
选择主题
点击右上角即可分享
微信分享提示