prometheus 基础使用记录

概述

  • 记录在使用prometheus常用功能和实验点
配置热更新
  • 启动配置热更新功能:–web.enable-lifecycle
  • 通过http发送热更新指令:http://prometheus-server:9090/-/reload
    注意该指令如正确,http响应码为200
    如错误,则响应码为500,并返回错误信息

failed to reload config: couldn’t load configuration
(–config.file="/prometheus/etc/prometheus.yml"): parsing YAML file
/prometheus/etc/prometheus.yml: yaml: line 40: could not find expected
‘:’

  • 服务端日志记录:

prometheus-server_1 | level=info ts=2020-02-18T14:15:54.663Z
caller=main.go:734 msg=“Loading configuration file”
filename=/prometheus/etc/prometheus.yml prometheus-server_1 |
level=info ts=2020-02-18T14:15:54.664Z caller=main.go:762
msg=“Completed loading of configuration file”
filename=/prometheus/etc/prometheus.yml

pushgateway 推送
  • 环境:启动prometheus-gateway服务,监听端口为:9091
  • 推送数据内容
cat <<EOF | curl --data-binary @- http://prometheus-gateway:9091/metrics/job/my_job/instance/my_instance

# TYPE my_metric counter

my_metric{label="val"} 88
EOF
  • 服务端抓取结果

my_metric{exported_instance=“my_instance”,exported_job=“my_job”,instance=“gateway:9091”,job=“prometheus”,label=“val”} 88

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值