背景

当prometheus的server与target不在同一网段网络不通,无法直接拉取target数据,需要使用pushgateway作为数据中转点。

弊端

将多个节点数据汇总到 pushgateway, 如果 pushgateway 挂了,受影响比多个 target 大。

Prometheus 拉取状态 up 只针对 pushgateway, 无法做到对每个节点有效。

Pushgateway 可以持久化推送给它的所有监控数据。即使你的监控已经下线,prometheus 还会拉取到旧的监控数据,需要手动清理 pushgateway 不要的数据。

实验环境

以下pushgateway分别prometheus exporter互通,其他都不通

prometheus 10.2.1.11

pushgateway 10.3.1.11

exporter 10.2.1.11

部署

pushgateway

下载安装包 pushgateway-0.8.0.linux-amd64.tar.gz (https://prometheus.io/download/#pushgateway/ )

tar -xvf pushgateway-0.8.0.linux-amd64.tar.gz -C /usr/local
mv /usr/local/pushgateway-0.8.0.linux-amd64 /usr/local/pushgateway

启动服务

 cd /usr/local/pushgateway/
./pushgateway &

prometheus

新增job pushgateway

vim /usr/local/prometheus/prometheus.yml
- job_name: 'pushgateway'
scrape_interval: 30s
honor_labels: true #加上此配置exporter节点上传数据中的一些标签将不会被pushgateway节点的相同标签覆盖
static_configs:
- targets: ['10.3.1.11:9091']
labels:
instance: pushgateway

查看target状态:

exporter

安装好node_exporter,此处不多介绍

传送监控数据到pushgateway节点

对于传过去的监控项会添加此处定义的标签 job=test instance=10.2.1.11 hostname=ip-10-2-1-11

curl 127.0.0.1:9100/metrics|curl --data-binary @- http://10.3.1.11:9091/metrics/job/test/instance/10.2.1.11/hostname/ip-10-2-1-11

此处也可以传送自定义的监控项值,以及自定义监控脚本抓取的值

echo "logic_cpu  5" |curl --data-binary @- http://10.3.1.11:9091/metrics/job/test/instance/10.2.1.11/hostname/ip-10-2-1-11

删除某个实例的数据:

curl -X DELETE http://10.3.1.11:9091/metrics/job/test/instance/10.2.1.11/hostname/ip-10-2-1-11

prometheus-pushgateway安装的更多相关文章

  1. prometheus学习系列十一: Prometheus pushgateway的使用

    由于网络问题或者安全问题,可能我们的数据无法直接暴露出一个entrypoint 给prometheus采集. 这个时候可能就需要一个pushgateway来作为中间者完成中转工作.  promethe ...

  2. Prometheus+Grafana安装搭建

    介绍 Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB).Prometheus使用Go语言开发,是Google BorgMon监控系统的开源版本. 2016年 ...

  3. Prometheus(一):Prometheus+Grafana 安装配置

    一.基础环境 系统 IP 监控主机 CentOS 7 192.168.56.200 被监控主机 CentOS 7 192.168.56.201 二.Prometheus服务端安装 以下操作皆在监控主机 ...

  4. 监控神器-普罗米修斯Prometheus的安装

    搬砖党的福音:普罗米修斯-监控神器 功能: 在业务层用作埋点系统 Prometheus支持多种语言(Go,java,python,ruby官方提供客户端,其他语言有第三方开源客户端).我们可以通过客户 ...

  5. prometheus虚拟化安装脚本

    在线安装下载链接:https://files.cnblogs.com/files/blogs/705493/online_prometheus.sh 离线安装下载链接:https://files.cn ...

  6. prometheus + grafana安装部署(centos6.8)

    官方网址:https://prometheus.io/ GitHub网址:https://github.com/prometheus/prometheus 软件下载地址:https://prometh ...

  7. 微服务监控神器Prometheus的安装部署

    本文涉及:如何在k8s下搭建Prometheus+grafana的监控环境 基本概念 Prometheus提供了容器和云原生领域数据搜集.存储.处理.可视化和告警一套完整的解决方案,最初时是由Soun ...

  8. prometheus部署安装

    1. 下载&部署 # 下载 [root@prometheus src]# cd /usr/local/src/ [root@prometheus src]# wget https://gith ...

  9. Prometheus完整安装

    官方组件: prometheus node_exporter blackbox_exporter alertmanager VictoriaMetrics 第三方开源软件: ConsulManager ...

  10. Prometheus 和 Grafana 安装部署

    Prometheus 是一套开源的系统监控报警框架.Prometheus 作为生态圈 Cloud Native Computing Foundation(简称:CNCF)中的重要一员,其活跃度仅次于 ...

随机推荐

  1. CDH6.2中capacity队列的分配

    配置: yarn.scheduler.capacity.root.queues

  2. easyUI关键(常见)组件详解

    一.easyUI 相关介绍 1.EasyUI 是前端框架,封装大量 css和封装大量 JS 2.使用前端框架时,给标签定义class 属性,就会有样式和脚本功能了(class属性对应了相关封装过的cs ...

  3. layer弹出框的简易封装和使用

    1. 封装layer 下载layer绿色版和jquery引入页面 <!DOCTYPE html> <html lang="zh-CN"> . . . < ...

  4. Electric Charges CodeForces - 623C (二分答案)

    大意: 平面上n个点每个点坐标为(x,0)或(0,y), 求任意两点距离平方最大值的最小值. 二分答案, 转化为判定最大值是否<=e, 按$x$排序后, 因为固定左端点, $y$绝对值的最大值是 ...

  5. 如何跳出iframe父级,打开一个链接

    假设使用window的跳转方法 ①window.parent.frames.location.href = "1.html";    //可以跳出iframe父级      此方法 ...

  6. python-文件操作3(读写文件的详细操作)

    f=open('my-heart','r') print(f.encoding)#返回字符编码 print(f.fileno())#返回操作系统的端口编号 print(f.seekable())#是否 ...

  7. SecureCRT文件和文件夹显示不同颜色(像linux中那样效果)

    如何设置secureCRT使用的他可以像linux文件和文件夹显示不同的颜色呢 原先显示效果如下: 效果图 配置

  8. Wide&Deep 模型学习教程

    WDL 学习教程 推荐系统+WDL 教学视频: https://www.bilibili.com/video/av29905315/ WDL 模型介绍: https://blog.csdn.net/g ...

  9. vue笔记(更新中)

    1.禁止div点击 2.禁止选择 -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; - ...

  10. Spring的概述

    1 Spring是什么? Spring是分层的Java SE/EE应用的full-stack的轻量级开源框架,以IOC(控制反转)和AOP(面向切面编程)为内核,提供了展现层SpringMVC和持久层 ...