prometheus学习系列十一: Prometheus exporter详解
exporter详解
前面的系列中,我们在主机上面安装了node_exporter程序,该程序对外暴露一个用于获取当前监控样本数据的http的访问地址, 这个的一个程序成为exporter,Exporter的实例称为一个target, prometheus通过轮训的方式定时从这些target中获取监控数据。
exporter是什么
广义上向prometheus提供监控数据的程序都可以成为一个exporter的,一个exporter的实例称为target, exporter来源主要2个方面,一个是社区提供的,一种是用户自定义的。
常用exporter
官方和一些社区提供好多exproter, 我们可以直接拿过来采集我们的数据。 官方的exporter地址: https://prometheus.io/docs/instrumenting/exporters/
Blackbox Exporter
bloackbox exporter是prometheus社区提供的黑盒监控解决方案,运行用户通过HTTP、HTTPS、DNS、TCP以及ICMP的方式对网络进行探测。这里通过blackbox对我们的站点信息进行采集。
blackbox的安装
# 进入下载目录
[root@node00 ~]# cd /usr/src/
# 下载
[root@node00 src]# wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.15.1/blackbox_exporter-0.15.1.linux-amd64.tar.gz
# 解压
[root@node00 src]# tar xf blackbox_exporter-0.15..linux-amd64.tar.gz
# 部署到特定位置
[root@node00 src]# mv blackbox_exporter-0.15..linux-amd64 /usr/local/exporter/
# 进入目录
[root@node00 src]# cd /usr/local/exporter/
# 软连接
[root@node00 exporter]# ln -s blackbox_exporter-0.15..linux-amd64 blackbox_exporter
# 进入自启目录
[root@node00 exporter]# cd /usr/lib/systemd/system
# 配置blackbox的开机自启文件
[root@node00 system]# cat blackbox_exporter.service
[Unit]
Description=blackbox_exporter
After=network.target [Service]
User=prometheus
Group=prometheus
WorkingDirectory=/usr/local/exporter/blackbox_exporter
ExecStart=/usr/local/exporter/blackbox_exporter/blackbox_exporter
[Install]
WantedBy=multi-user.target # 启动
[root@node00 system]# systemctl restart blackbox_exporter
# 查看状态
[root@node00 system]# systemctl status blackbox_exporter
# 开机自启
[root@node00 system]# systemctl enable blackbox_exporter
配置prometheus采集数据
- job_name: "blackbox"
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP response.
file_sd_configs:
- refresh_interval: 1m
files:
- "/usr/local/prometheus/prometheus/conf/blackbox*.yml"
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.100.10:
[root@node00 prometheus]# cat conf/blackbox-dis.yml
- targets:
- https://www.alibaba.com
- https://www.tencent.com
- https://www.baidu.com
grafana展示blackbox采集数据
重启prometheus查看数据, 可以在grafana导入dashboard id 9965 可以看到如下数据。

influxdb_export
influxdb_export 是用来采集influxdb数据的指标的,但是influxdb提供一个专门的一个产品来暴露metrics数据, 也就是说infludb_exporter这个第三方的产品将来会被淘汰了。 不过还是可以使用的,可以参考: https://github.com/prometheus/influxdb_exporter
infludb官方的工具来获取metrics数据是telegraf, 这个工具相当的强大,内部使用prometheus client插件来暴露数据给prometheus采集, 当然这个工具内部集成了几十种插件用户暴露数据给其他的监控系统。 详细的可以参考官方地址: https://docs.influxdata.com/telegraf/v1.7/plugins/outputs/#prometheus-client-prometheus-client-https-github-com-influxdata-telegraf-tree-release-1-7-plugins-outputs-prometheus-client
这里我们使用的监控系统是prometheus, 只需要关注如下配置即可: https://github.com/influxdata/telegraf/tree/release-1.7/plugins/outputs/prometheus_client
telegraf的安装配置
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.12.2-1.x86_64.rpm
sudo yum localinstall telegraf-1.12.-.x86_64.rpm rpm -ql |grep telegraf
cp /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.default
# 修改如下部分
[[outputs.prometheus_client]]
## Address to listen on
listen = ":9273" systemctl restart telegraf
systemctl status telegraf
systemctl enabletelegraf
集成prometheus
# prometheus加入如下采集
- job_name: "influxdb-exporter"
static_configs:
- targets: [ "192.168.100.10:9273" ]
查看数据

prometheus学习系列十一: Prometheus exporter详解的更多相关文章
- prometheus学习系列十一: Prometheus 安全
prometheus安全 我们这里说的安全主要是基本认证和https2种, 目前这2种安全在prometheus中都没有的, 需要借助第三方软件实现, 这里以nginx为例. 基本认证 配置基本认证 ...
- prometheus学习系列十一: Prometheus pushgateway的使用
由于网络问题或者安全问题,可能我们的数据无法直接暴露出一个entrypoint 给prometheus采集. 这个时候可能就需要一个pushgateway来作为中间者完成中转工作. promethe ...
- prometheus学习系列十一: Prometheus和AlertManager的高可用
前面的系列中, prometheus和alertmanager都是单机部署的,会有单机宕机导致系统不可用情况发生.本文主要介绍下prometheus和alertmanager的高可用方案. 服务的高可 ...
- prometheus学习系列十一: Prometheus 采集器的编写
在前面的文章已经写了官方的几个exporter的使用了. 在实际使用环境中,我们可能需要收集一些自定义的数据, 这个时候我们一般是需要自己编写采集器的. 快速入门编写一个入门的demo 编写代码 fr ...
- prometheus学习系列十一: Prometheus 报警规则配置
prometheus监控系统的的报警规则是在prometheus这个组件完成配置的. prometheus支持2种类型的规则,记录规则和报警规则, 记录规则主要是为了简写报警规则和提高规则复用的, 报 ...
- PE文件学习系列三-PE头详解
合肥程序员群:49313181. 合肥实名程序员群:128131462 (不愿透露姓名和信息者勿加入) Q Q:408365330 E-Mail:egojit@qq.com 最近比较忙 ...
- JavaScript学习总结(十一)——Object类详解
一.Object类介绍 Object类是所有JavaScript类的基类(父类),提供了一种创建自定义对象的简单方式,不再需要程序员定义构造函数. 二.Object类主要属性 1.constructo ...
- Linux学习之文件特殊权限详解(SetUID、SetGID、Sticky BIT)(十一)
Linux学习之文件特殊权限详解(SetUID.SetGID.Sticky BIT) 目录 SetUID SetGID Sticky BIT SetUID SetUID简介 只有可以执行的二进制程序和 ...
- ASP.NET MVC深入浅出系列(持续更新) ORM系列之Entity FrameWork详解(持续更新) 第十六节:语法总结(3)(C#6.0和C#7.0新语法) 第三节:深度剖析各类数据结构(Array、List、Queue、Stack)及线程安全问题和yeild关键字 各种通讯连接方式 设计模式篇 第十二节: 总结Quartz.Net几种部署模式(IIS、Exe、服务部署【借
ASP.NET MVC深入浅出系列(持续更新) 一. ASP.NET体系 从事.Net开发以来,最先接触的Web开发框架是Asp.Net WebForm,该框架高度封装,为了隐藏Http的无状态模 ...
随机推荐
- Android Studio 之 GridView
1. 数据源 ArrayList Cursor 2. 适配器 Adapter ArrayAdapter SmipleAdapter SmipleCursorAdapter BaseAdapter
- centos git编译
1. 下载git源码 https://git-scm.com 2. 根据文档一步步操作 https://git-scm.com/book/en/v2/Getting-Started-Installin ...
- atlassian-confluence - docker安装
一下内容在centos 7安装成功.一.安装docker 1.yum安装docker12 yum update # 更新yumyum install docker # yum安装docker 2.开启 ...
- 关于MySQL 通用查询日志和慢查询日志分析(转)
MySQL中的日志包括:错误日志.二进制日志.通用查询日志.慢查询日志等等.这里主要介绍下比较常用的两个功能:通用查询日志和慢查询日志. 1)通用查询日志:记录建立的客户端连接和执行的语句. 2)慢查 ...
- C++ getline()的两种用法
getline():用于读入一整行的数据.在C++中,有两种getline函数.第一种定义在头文件<istream>中,是istream类的成员函数:第二种定义在头文件<string ...
- 一文让你彻底理解准确率,精准率,召回率,真正率,假正率,ROC/AUC
参考资料:https://zhuanlan.zhihu.com/p/46714763 ROC/AUC作为机器学习的评估指标非常重要,也是面试中经常出现的问题(80%都会问到).其实,理解它并不是非常难 ...
- MySql Packet for query is too large问题解决方案
MySQL会限制Server接受的数据包大小.有时候插入.更新或查询时数据包的大小,会受 max_allowed_packet 参数限制,导致操作失败.报错信息为: Caused by: com.my ...
- 【转帖】威盛x86 AI处理器架构、性能公布:媲美Intel 32核心
威盛x86 AI处理器架构.性能公布:媲美Intel 32核心 https://www.cnbeta.com/articles/tech/920559.htm 除了Intel.AMD,宝岛台湾的威盛也 ...
- pip install 时报错 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
pip install 时报错: pip is configured with locations that require TLS/SSL, however the ssl module in Py ...
- idea Autowired 提示红色的解决方式