【监控系统】Prometheus监控组件Node-Exporter配置实战

这一节,我们来配置一下Node-Exporter,那么我们先来了解一下什么是Prometheus的Exporter?

任何向Prometheus提供监控样本数据的程序都可以被称为一个Exporter,它是一种用于将不同数据源的指标提供给Prometheus进行收集和监控的工具。运行在应用程序、计算机、网络设备或者其他系统上的代码,它可以将系统的指标信息以一种标准格式公开。将指标数据公开为HTTP端点或者指定的格式(如Redis、JMX等),Prometheus然后可以通过轮询或指定的抓取器。

Exporter是Prometheus的指标数据收集组件,负责从目标Jobs收集数据。并把收集到的数据转换为Prometheus支持的时序数据格式。只负责收集,并不向Server端发送数据,而是等待Prometheus Server 主动抓取。

Prometheus社区以及其他团队开发了大量的Exporter,覆盖了许多不同类型的系统和服务。Node Exporter、MySQL Exporter、Redis Exporter、MongoDB Exporter、Nginx Exporter...

使用方式:在主机上安装了一个 Exporter程序,该程序对外暴露了一个用于获取当前监控样本数据的HTTP访问地址。Prometheus通过轮询的方式定时从这些Target中获取监控数据样本,并且存储在数据库当中。

案例实战-安装部署 **node_exporter **

node_exporter 用于采集类UNIX内核的硬件以及系统指标,包括CPU、内存和磁盘。

下载node_exporter 组件

bash 复制代码
https://prometheus.io/download/
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

下载安装包到Linux服务器

bash 复制代码
#解压
tar -zxvf node_exporter-1.6.0.linux-amd64.tar.gz

配置启动文件,设置自启动:vi /usr/lib/systemd/system/node_exporter.service

注意:ExecStart配置node_exporter目录下的node_exporter启动器

bash 复制代码
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
 
[Service]
Type=simple
ExecStart=/usr/local/software/node_exporter/node_exporter \
--collector.ntp \
--collector.mountstats \
--collector.systemd \
--collector.tcpstat
 
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

启动node_exporter ,设置开机自启,检查服务启动情况

bash 复制代码
systemctl start node_exporter
 
systemctl enable node_exporter
 
netstat -natp | grep :9100

[root@localhost /]# netstat -natp | grep :9100
tcp6       0      0 :::9100                 :::*                    LISTEN      1390/node_exporter  

通过浏览器访问 http://IP+9100/metrics可以查看到监控信息

Prometheus服务器中添加被监控机器的配置 vim prometheus.yml, target的也可以写ip

yml 复制代码
  - job_name: 'agent-1'
    static_configs:
      - targets: ['ip:9100']

动态更新配置 curl -X POST http://localhost:9090/-/reload

查看Web UI界面的target和configuration是否有对应的数据

Ok,Prometheus监控组件Node-Exporter的实操就结束啦,记得三连➕关注哦!

相关推荐
Elastic 中国社区官方博客21 分钟前
使用 Elasticsearch 作为 Grafana 的直接替代 Prometheus 后端
大数据·数据库·sql·elasticsearch·搜索引擎·grafana·prometheus
XTIOT66623 分钟前
CRPT 诚实标识采集落地技术实践:分工况硬件选型与合规数据标准化解决方案
大数据·运维·人工智能·嵌入式硬件·物联网
白白白飘1 小时前
【8】补充与拓展:Langchain的联网搜索Agent,使用Tavily工具
服务器·网络·langchain
草邦设计开发团队_媒体资源平台1 小时前
Linux 稳定常驻启动 PHP 队列,服务器重启自动恢复
linux·服务器·php·队列执行
想你依然心痛2 小时前
嵌入式容器:Docker与BalenaOS在边缘设备上的实践——容器运行时与OTA
运维·docker·容器
竣达技术2 小时前
NAS / 服务器断电数据丢失?UPS 配套 USB关机保护板,市电断电池低自动提示服务器/电脑关机
运维·服务器·电脑
Lottie20262 小时前
京东电商进阶运营:精准定价+安全铺货+竞品监控+利润管控全自动化方案
运维·安全·自动化
章老师说2 小时前
NGINX官方谈Lua风险:这其实是两条网关技术路线之争
运维·nginx·负载均衡·lua·openresty
国科安芯2 小时前
基于ASM1042S2S的箭载通信网络抗辐射加固方案研究
服务器·网络·嵌入式硬件·fpga开发·架构·信号处理
wbs_scy2 小时前
仿 muduo 高并发服务器项目:实现 Any 通用容器并理解 std::any
运维·服务器