Prometheus-自定义监控指标 pushgateway

简介: Prometheus-自定义监控指标 pushgateway

自定义监控指标 pushgateway

# 下载地址
https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz

# 解压
tar xf pushgateway-1.4.0.linux-amd64.tar.gz
mv pushgateway-1.4.0.linux-amd64 pushgateway-1.4.0

# 添加配置文件
vim /usr/lib/systemd/system/pushgateway.service
                            
[Unit]
Description=pushgateway
After=network.target

[Service]
ExecStart=/opt/pushgateway-1.4.0/pushgateway  

Restart=on-failure

[Install]
WantedBy=multi-user.target

# 启动
/opt/pushgateway-1.4.0/pushgateway  --web.listen-address="0.0.0.0:9091"
systemctl daemon-reload
systemctl start pushgateway.service

# Prometheus配置
- job_name: 'pushgateway'
  static_configs:
  - targets: ['pushgatewayIP:9091']
  honor_labels: true        #作用:如果没有设置instance标签,Prometheus服务器也会附加标签,否则instance标签值会为空


cat <<EOF | curl --data-binary @- http://x.x.x.x:9091/metrics/job/some_job/instance/some_instance
# TYPE some_metric counter
some_metric{label="val1"} 42
# TYPE another_metric gauge
# HELP another_metric Just an example.
another_metric 2398.283
EOF

echo "some_metric 3.14" | curl --data-binary @- http://pushgateway.example.org:9091/metrics/job/some_job
echo "zhangning 3306" | curl --data-binary @- http://x.x.x.x:9091/metrics/job/redis/instance/3306

echo "key value" | curl --data-binary @- http://ip地址:9091/metrics/job标签名/job标签命名/instance名/实例标签命名




https://www.cnblogs.com/zqj-blog/p/11106724.html
https://www.cnblogs.com/zqj-blog/p/11024834.html
https://github.com/cppla/ServerStatus
https://github.com/tianshiyeben/wgcloud

# 接口监控
https://github.com/liwei128/apimonitor
https://github.com/jsyzjhj/httpMonitor
https://github.com/yjlch1016/dmonitor
https://github.com/yangziwen/web-monitor
相关文章
|
2月前
|
存储 JSON Prometheus
如何精简 Prometheus 的指标和存储占用
如何精简 Prometheus 的指标和存储占用
|
2月前
|
存储 Prometheus Kubernetes
「译文」通过 Relabel 减少 Prometheus 指标的使用量
「译文」通过 Relabel 减少 Prometheus 指标的使用量
|
3月前
|
编解码 Prometheus 运维
Prometheus 的监控方法论
【1月更文挑战第24天】
|
3月前
|
存储 Prometheus 监控
Prometheus vs. ELK Stack:容器监控与日志管理工具的较量
随着容器化技术的广泛应用,容器监控与日志管理成为了关键任务。本文将对两种常用工具进行比较与选择,分别是Prometheus和ELK Stack。Prometheus是一款开源的监控系统,专注于时序数据的收集和告警。而ELK Stack则是一套完整的日志管理解决方案,由Elasticsearch、Logstash和Kibana三个组件组成。通过比较它们的特点、优势和适用场景,读者可以更好地了解如何选择适合自己需求的工具。
|
2月前
|
Prometheus 监控 Kubernetes
如何用 Prometheus Operator 监控 K8s 集群外服务?
如何用 Prometheus Operator 监控 K8s 集群外服务?
|
2月前
|
Prometheus 监控 Kubernetes
Prometheus Operator 与 kube-prometheus 之二 - 如何监控 1.23+ kubeadm 集群
Prometheus Operator 与 kube-prometheus 之二 - 如何监控 1.23+ kubeadm 集群
|
2月前
|
Prometheus 监控 Cloud Native
使用 Prometheus 配置 SLO 监控和告警
使用 Prometheus 配置 SLO 监控和告警
|
2月前
|
Prometheus Cloud Native
「译文」如何使用 PromQL join 来更有效地查询大规模的 Prometheus 指标
「译文」如何使用 PromQL join 来更有效地查询大规模的 Prometheus 指标
|
3月前
|
Prometheus 监控 Java
微服务框架(二十四)Prometheus 监控埋点
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为Prometheus 监控埋点 本系列文章中所使用的框架版本为Spring Boot 2.0.3-REL...
|
3月前
|
Prometheus 监控 Cloud Native
微服务框架(二十二)Prometheus + Grafana 可视化监控
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为Prometheus + Grafana 可视化监控的介绍,下篇为Prometheus + Grafana...