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

地址: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. 「玩转Python」突破封锁继续爬取百万妹子图

    前言 从零学 Python 案例,自从提交第一个妹子图版本引来了不少小伙伴的兴趣.最近,很多小伙伴发来私信说,妹子图不能爬了!? 趁着周末试了一把,果然爬不动了,爬下来的都是些 0kb 的假图片,然后 ...

  2. dockerfile 制作镜像

    # Set the base image to UbuntuFROM ubuntu # File Author chenghanMAINTAINER chenghan ################ ...

  3. py+selenium 报错NameError: name 'NoSuchElementException' is not defined【已解决】

     报错:NameError: name 'NoSuchElementException' is not defined  如图 解决方法: 头部加一句:from selenium.common.exc ...

  4. [记录]HAproxy负载均衡配置教程

    HAproxy负载均衡配置教程 一.简介 haproxy是一个开源的高性能负载均衡软件:支持双机热备.虚拟主机和图形化的管理界面,自带强大的对RS健康检查功能:支持TCP(四层).HTTP(七层)应用 ...

  5. 一文带你了解git

    git简介 什么是git? git是当今世界上最先进的分布式的版本控制系统. 版本控制系统分集中式的和分布式的,集中式的主要代表有CVS.SVN,而Git是分布式版本控制系统的佼佼者. 那什么是集中式 ...

  6. Excel催化剂开源第29波-在Winform上使用富文本编辑器控件

    富文本编辑器,一般都是BS架构专利一般,好像百度有一个开源的比较出名,但无奈这些都只能用在JS上,在BS网页端开发上使用.像Winform开发的VSTO,只能羡慕的份.和一般Winform上用的Ric ...

  7. (图文教程)IntelliJ IDEA 导入Eclipse/MyEclipse 项目 配置详解+快捷键分享

    (图文教程)IntelliJ IDEA 导入Eclipse/MyEclipse 项目 配置详解+快捷键分享 IntelliJ IDEA 使用教程.快捷键配置. 该教程针对原始jar包依赖的工程.mav ...

  8. [leetcode] 17. Letter Combinations of a Phone Number (medium)

    递归DFS class Solution { Map<Character, String> mapping = new HashMap<>(); public List< ...

  9. [leetcode] 392. Is Subsequence (Medium)

    原题 判断子序列 /** * @param {string} s * @param {string} t * @return {boolean} */ var isSubsequence = func ...

  10. MySql(Windows)

    百度云:链接:http://pan.baidu.com/s/1nvlSzMh      密码:o1cw 官网下载网址:http://dev.mysql.com/downloads/mysql/