背景

当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/ )

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

启动服务

  1. cd /usr/local/pushgateway/
  2. ./pushgateway &

prometheus

新增job pushgateway

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

查看target状态:

exporter

安装好node_exporter,此处不多介绍

传送监控数据到pushgateway节点

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

  1. 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

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

  1. 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

删除某个实例的数据:

  1. 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. 教你用 Netty 实现一个简单的 RPC!

    众所周知,dubbo 底层使用了 Netty 作为网络通讯框架,而 Netty 的高性能我们之前也分析过源码,对他也算还是比较了解了. 今天我们就自己用 Netty 实现一个简单的 RPC 框架. 1 ...

  2. 使用批处理选择运行控制台程序(简易cui)

    批处理可以用于启动一些控制台程序.昨天在github上找到一个有意思的项目OpenRA : 一个开源的红警游戏. 发现该游戏的启动程序(launch-game)是用批处理写的 就学习了下 *没有玩过批 ...

  3. 普通交叉验证(OCV)和广义交叉验证(GCV)

    普通交叉验证OCV OCV是由Allen(1974)在回归背景下提出的,之后Wahba和Wold(1975)在讨论 了确定多项式回归中多项式次数的背景,在光滑样条背景下提出OCV. Craven和Wa ...

  4. composer之predis

    安装:   composer require predis/predis   即可 predis是PHP连接Redis的操作库,由于它完全使用php编写,大量使用命名空间以及闭包等功能,只支持php5 ...

  5. 在 sessionStorage存储json对象

    目的:A页面存的东西要从B页面拿到 因为sessionStorage.setItem("key","value")内存储的都是字符串,所以,如果以对象的形式存到 ...

  6. js 不常用面试题 数组对象深度取值

    function getPersonInfo(one, two, three) { console.log(one); console.log(two); console.log(three); } ...

  7. Windows向Linux上传文件夹

      1.将文件夹压缩成.tar.gz文件: 安装7-Zip,选择要压缩的文件夹--右键--“7-Zip”--“添加到压缩包...”,压缩格式选择“tar”, 在此目下就生成了“文件夹名.tar”文件, ...

  8. AIX中的页空间管理

    1.页空间简介(Paging  Space) 页空间是指硬盘上的存储内存信息的区域. 一个页空间也叫做一个交换空间. 是系统中一个类型为paging的逻辑卷.       2.创建页空间 使用mkps ...

  9. 008-zabbix监控nginx

    (1)agent端配置 1)nginx编译安装需要加上该选项--with-http_stub_status_module 2)修改nginx配置文件 #vim /usr/local/nginx/con ...

  10. Ubuntu16.04下安装httpd+svn+viewVC

    一.安装httpd 1.下载httpd 网址:http://httpd.apache.org/download.cgi#apache24 下载这一条---Source: httpd-2.4.39.ta ...