背景

当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. map的常见用法

    map的常见用法 map 是什么? map是一组键值对的组合,通俗理解类似一种特殊的数组,a[key]=val,只不过数组元素的下标是任意一种类型,而且数组的元素的值也是任意一种类型.有点类似pyth ...

  2. CodeForces-520E Pluses everywhere

    题目描述 给出一个长度为 \(n\) 的字符串,给出一个非负整数 \(k\),要求给这个字符串中间添加 \(k\) 个$\(+\)'号,变成一个表 达式,比如"\(1000101\)&quo ...

  3. mysql整理-常用sql语句

    一.常用sql show variables like 'character_set_client';#查询字符集 show databases;#列出所有的服务器上的数据库alter create ...

  4. pythonWeb框架创建app模块以及虚拟环境管理工具

    在进行项目搭建的时候,如果有多个功能模块,以及多个网页地址时,为了系统的可维护性,以及易读性,我们大多数情况下选择模块化开发 所以我们就要使用app指令来创建不同的功能模块 首先项目框架如下: 接下来 ...

  5. hadoop-组件

    hadoop1.x 和 hadoop2.x 区别 HDFS 分布式文件存储系统 优点   缺点 MapReduce 分布式计算 详见我的博客 mapreduce YARN 计算资源管理器 主要了解两个 ...

  6. php文件上传错误信息说明对照表

    php文件上传错误信息说明对照表: UPLOAD_ERR_OK:其值为0,没有错误发生,文件上传成功UPLOAD_ERR_INI_SIZE:其值为1,上传的文件超过了php.ini中upload_ma ...

  7. notes-19-05-10

    一 mysql查找一个表中字段相同的数据  2019-05-10 15:51:03   多字段 ) 二 Referer的作用?2019-05-17 10:03:48 (来自网络) 1.防盗链我在www ...

  8. 21个CSS3 / JS 时钟

    收集了21个酷炫的CSS / JS实现的时钟效果https://oktools.net/clocks 预览 :https://clocks.oktools.net/0/ 源码 :https://cod ...

  9. python程序超时处理 timeout_decorator

    如下两个例子,实现对某个函数的超时处理(其实就是加了一个装饰器timeout): 成功例子: 代码: import time import timeout_decorator @timeout_dec ...

  10. 一、doT.js使用笔记

    一.赋值https://www.jianshu.com/p/19156f9fac1e <!DOCTYPE html> <html> <head> <meta ...