文章首发于公众号《程序员果果》

地址:https://mp.weixin.qq.com/s/40ULB9UWbXVA21MxqnjBxw

简介

Prometheus 官方和一些第三方,已经把一些常用数据库、系统、中间件等的指标数据的采集做成了一个个 exporter,在生产环境中,直接导入使用就可以。 这一节,我们就用 Prometheus 官方提供的 Node Exporter 来完成对Linux系统运行数据的采集 。

实验

Node Exporter 安装及运行

在一台 Linux 机器上安装并运行 Node Exporter,我使用的是一台 ip 为 172.16.2.101 的Linux 虚拟机。

下载地址:https://github.com/prometheus/node_exporter/releases

下载并解压:

wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz

tar zxvf node_exporter-0.18.1.linux-amd64.tar.gz

进入 node_exporter-0.18.1.linux-amd64 文件夹 启动node_exporter:

./node_exporter

Prometheus 配置

在 prometheus.yml 中配置 node_exporter 的metrics 端点,内容如下:

global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_timeout: 5s scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'linux-exporter'
metrics_path: /metrics
static_configs:
- targets: ['172.16.2.101:9100']

启动 prometheus:

docker run --name prometheus -d -p 9090:9090 -v /root/prometheus-data:/prometheus-data \
prom/prometheus --web.enable-lifecycle --config.file=/prometheus-data/prometheus.yml

访问 http://172.16.2.101:9090/targets 发现已经出现了 target “node_exporter” ,并且为UP状态。

Grafana 导入 DashBoard

Grafana 官方和社区对已经做好了常用的 DashBoard,可以访问 https://grafana.com/grafana/dashboards 进行查询:

选择下载最多的,点击进去:

DashBoard 的 id 为 8919,后面要用到。

启动 Grafana

docker start grafana

通过Grafana的 + 图标导入(Import) Node Exporter dashboard:

  • grafana id = 8919
  • 注意选中prometheus数据源

点击 "Import" 会跳转到 监控界面:

通过界面可以直观的看到 主机cpu占用率 、负载、磁盘空间、内存等信息。

总结

这一节 ,通过集成 Node Exporter 来演示了 exporter 的使用。之后你可以利用Prometheus 官方提供的其他 exporter 应用到你的学习或工作中,例如 MySQL Server Exporter 、Redis exporter 等等。

往期内容

欢迎扫码或微信搜索公众号《程序员果果》关注我,关注有惊喜~

Prometheus 集成 Node Exporter的更多相关文章

  1. Prometheus exporter的Node exporter是可以独立安装,用来测试的

    现在慢慢在把prometheus operator的一些概念组织完整. https://github.com/coreos/prometheus-operator/tree/master/contri ...

  2. 【开源监控】Prometheus+Node Exporter+Grafana监控linux服务器

    Prometheus Prometheus介绍 Prometheus新一代开源监控解决方案.github地址 Prometheus主要功能 多维 数据模型(时序由 metric 名字和 k/v 的 l ...

  3. Prometheus + Node Exporter + Grafana 监控主机运行信息

      上一篇文章中讲了如何利用Prometheus和Grafana监控SpringBoot应用的JVM信息,这次就来看看如何监控 服务器运行状态,先列出用到的工具: Prometheus node_ex ...

  4. Prometheus 使用之 node exporter

    本文使用的 Prometheus 版本为 2.22.0,node exporter 版本为 1.0.1:部署在 Linux 服务器Prometheus 是开源的监控报警系统和时序列数据库 (TSDB) ...

  5. Prometheus Node_exporter 之 Node Exporter

    Node Exporter 1. Node Exporter Scrape Time type: GraphUnit: secondsLabel: Seconds{{collector}} - 各个收 ...

  6. Prometheus 安装Grafana与Prometheus集成

    Prometheus 安装Grafana与Prometheus集成 Grafana是一个开源的度量分析和可视化系统. 下载地址:https://grafana.com/grafana/download ...

  7. Node Exporter监控指标

    访问http://localhost:9100/metrics,可以看到当前node exporter获取到的当前主机的所有监控数据,如下所示: 每一个监控指标之前都会有一段类似于如下形式的信息: # ...

  8. node exporter

    在prometheus中负责数据汇报的程序统一叫做exporter; 负责主机信息收集的node_exporter 可以利用prometheus的static_configs来拉取node_expor ...

  9. zeebe 集成elasticsearch exporter

    zeebe 目前还在一直的开发中,同时一些变动还是挺大的,比如simple monitor 的以前是不需要配置HazelcastExporter的 估计是为了进行集群功能处理,新添加的,以前写的配置基 ...

随机推荐

  1. 托管堆和垃圾回收(GC)

    一.基础 首先,为了深入了解垃圾回收(GC),我们要了解一些基础知识: CLR:Common Language Runtime,即公共语言运行时,是一个可由多种面向CLR的编程语言使用的"运 ...

  2. 20131221-Dom练习-第二十六天(未完)

    [1] //总结,写代码,一要动脑,理解用脑 //二要练,要动手,要有用身体记忆代码的觉悟,记忆用手 //三学编程最快的方法是,直接接触代码,用脑,用手接触代码 //面向对象的编码方式,对象还是对象, ...

  3. MySQL5.7.20源码安装以及pt-query-digest用法示例

    MySQL5.7.20源码安装1.下载解压cd /data/app/mysql5.7wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5 ...

  4. python函数知识一 函数初始、定义与调用、返回值、参数和函数的好处+菜中菜

    第四章 函数 1.函数初识: def :关键字 -- 定义 函数名:和变量的定义方式一样 (): 用于参数传递,: 形参:函数的定义中()内的是形参 实参:调用的()内是实参 传参:调用时将实参传递给 ...

  5. c++小游戏——杀手

    杀手小游戏 会有一个存活者:(1 2 3 4 5),如果出现(1 0 3 4 5),代表二号已经死了. 一号有3次复活权 且有一次随机诅咒权(即当自己被杀死时,会随机诅咒另外一个人,当然不是死人或自己 ...

  6. 「数据分析」Sqlserver中的窗口函数的精彩应用之数据差距与数据岛(含答案)

    上一篇介绍过数据差距与数据岛的背景,这里不再赘述,请翻阅上一文.此篇在Sqlserver上给大家演示1000万条记录的计算性能. 测试电脑软硬件说明 一般般的笔记本电脑,2017年7月,价格:4500 ...

  7. leetcode 198. House Robber (Easy)

    https://leetcode.com/problems/house-robber/ 题意: 一维数组,相加不相邻的数组,返回最大的结果. 思路: 一开始思路就是DP,用一维数组保存dp[i]保存如 ...

  8. 总结暨JAVAWEB学习开篇(一)

    匆匆,距上一篇博客已经过去7月有余,遂作文一篇总结暨JAVAWEB学习开篇. 1. 啃英文新概念.在多方讨教英语大佬后改变学习方式,通过背诵英文书籍以及多听英文录音来学习,效果还不错(等真正有成效了跟 ...

  9. python函数闭包-装饰器-03

    可调用对象 callable()  # 可调用的(这个东西加括号可以执行特定的功能,类和函数) 可调用对象即  callable(对象)  返回为  True  的对象 x = 1 print(cal ...

  10. mybatis01-1测试

    首先需要数据源信息和日志文件 然后一个SQLMapConfig.xml配置文件连接数据库并且映射后一个xml文件,另一个xml文件写入SQL语句, 最后text测试文件读取第一个配置文件,放到SQLS ...