Prometheus - Node Exporter

简介: Exporter 是由于向 Prometheus 提供监控数据的程序,通常 Exporter 也抽象成一个 Target, Prometheus 通过 Pull 模式往 Target 中获取监控数据。

Exporter 是由于向 Prometheus 提供监控数据的程序,通常 Exporter 也抽象成一个 Target, Prometheus 通过 Pull 模式往 Target 中获取监控数据。

来源区分

社区提供的 Exporter

自定义的 Exporter


支持方式区分

独立的 Exporter 去暴露服务,例如 MySQL Exporter、Consul Exporter

服务自包含的 Exporter,例如 Kubelet 内置 cAdvisor、etcd



https://github.com/prometheus/node_exporter

Node Exporter 部署


Node Exporter 在 Kubernetes 上可以直接通过 DaemonSet 的方式在每一个节点上启动一个Pod

并且和宿主机共用同一个 Network Namespace 或者通过 HostNetwork 的方式暴露 Metrics 端口


apiVersion: apps/v1
kind: DaemonSet
metadata:  name: node-exporter-daemonset
  namespace: monitoring
spec:  selector:    matchLabels:      app: node-exporter-daemonset
  template:    metadata:      labels:        app: node-exporter-daemonset
    spec:      containers:        - image: 'prom/node-exporter:v1.1.2'          name: node-exporter-daemonset
          ports:- containerPort: 9100              hostPort: 9100              name: metrics
              protocol: TCP
      dnsPolicy: ClusterFirst
      hostNetwork: true      volumes:        - hostPath:            path: /proc
            type: ''          name: proc
        - hostPath:            path: /sys
            type: ''          name: sys
        - hostPath:            path: /
            type: ''          name: root
---    spec:      containers:          image: 'prom/node-exporter:v1.1.2'          name: node-exporter-daemonset
          ports:            - containerPort: 9528              name: metrics
              protocol: TCP
 hostNetwork: true


Node Exporter 数据暴露


通过 http://NodeIP:9100/metrics 去查看暴露的数据

image.jpeg



配置 Prometheus 采集规则


cat prometheus.yml

global:  scrape_interval:     15s
  evaluation_interval: 15s
scrape_configs:  - job_name: 'node-exporter'    file_sd_configs:    - files:      - targets/node-exporter.yml
      refresh_interval: 1m
cat targets/node-exporter.yml
- targets:  - "172.20.31.195:9100"  - "172.20.31.196:9100"  - "172.20.31.197:9100"


# 效果同样,只不过以下这种可以根据不同的目标去配置标签等信息。

cat targets/node-exporter.yml

- targets: ["172.20.31.195:9100"]- targets: ["172.20.31.196:9100"]- targets: ["172.20.31.197:9100"]

image.jpeg


Grafana

Dashboard ID:  11074

image.jpeg









目录
相关文章
|
5月前
|
消息中间件 Prometheus 监控
Prometheus实战篇:什么是Exporter
所有可以向Prometheus提供监控样本数据的程序都可以被称为一个Exporter.而Exporter的一个实例称为target,如图下所示, Prometheus通过轮询的方式定期从这些target中获取样本数据
|
7月前
|
存储 Prometheus 监控
服务搭建篇(一) 搭建基于prometheus + node_exporter + grafana + Alertmanager 的监控报警系统 , 保姆级教程
Alertmanager处理客户端应用程序(如Prometheus服务器)发送的警报。它负责重复数据删除、分组,并将它们路由到正确的接收器集成,如电子邮件、PagerDuty或OpsGenie。它还负责静音和抑制警报
194 0
|
8月前
|
Prometheus 监控 Cloud Native
如何使用 Node Exporter 监控 Linux 上的磁盘 I/O
如何使用 Node Exporter 监控 Linux 上的磁盘 I/O
169 0
|
9月前
|
Prometheus Cloud Native Linux
Prometheus(二)之Node Exporter采集Linux主机数据
Prometheus(二)之Node Exporter采集Linux主机数据
174 0
|
10月前
|
Prometheus 监控 Cloud Native
【实战】CentOS7 Prometheus+Grafana面板搭建+监控node_exporter+监控mysqld_exporter
有3台主机(CentOS7): 192.168.188.100 服务端 192.168.188.101 客户端 192.168.188.102 客户端 100部署Prometheus(9090)+Grafana(3000) 101部署node_exporter(39100)模块,监控该服务器所用资源情况 102部署mysqld_exporter(39200)模块,监控该服务器上的数据库使用情况
598 0
|
10月前
|
JSON Prometheus 监控
使用Exporter为Prometheus添加监控对象(持续更新ing)
使用Exporter为Prometheus添加监控对象(持续更新ing)
209 0
|
4月前
|
编解码 Prometheus 运维
Prometheus 的监控方法论
【1月更文挑战第24天】
|
4月前
|
存储 Prometheus 监控
Prometheus vs. ELK Stack:容器监控与日志管理工具的较量
随着容器化技术的广泛应用,容器监控与日志管理成为了关键任务。本文将对两种常用工具进行比较与选择,分别是Prometheus和ELK Stack。Prometheus是一款开源的监控系统,专注于时序数据的收集和告警。而ELK Stack则是一套完整的日志管理解决方案,由Elasticsearch、Logstash和Kibana三个组件组成。通过比较它们的特点、优势和适用场景,读者可以更好地了解如何选择适合自己需求的工具。
|
3月前
|
Prometheus 监控 Kubernetes
如何用 Prometheus Operator 监控 K8s 集群外服务?
如何用 Prometheus Operator 监控 K8s 集群外服务?
|
3月前
|
Prometheus 监控 Kubernetes
Prometheus Operator 与 kube-prometheus 之二 - 如何监控 1.23+ kubeadm 集群
Prometheus Operator 与 kube-prometheus 之二 - 如何监控 1.23+ kubeadm 集群